0

I'm trying to read and set Excel cells values with Cells(1,1). I was successful with reading this value. But I've seen code with Cells(1,1).Value(). So when should I use the notation itself: Cells(1,1) and notation with .Value() (Text()/Value2())?

Erik A
  • 31,639
  • 12
  • 42
  • 67
egor7
  • 4,678
  • 7
  • 31
  • 55

1 Answers1

1

The default property of Cells in VBA is Value. There's no difference in using it vs not using it.

I prefer to explicitly define the Value property though for the sake of debugging and helping others who may read my code in future as it is a clear indication of what the code is trying to achieve.

Gareth
  • 5,140
  • 5
  • 42
  • 73
  • 2
    This holds especially true if you're also handling `Range` variables in your code, as you won't be confused if you, for example, are also copying Ranges. For more infos on .Text/.Value/.Value2 see [this SO link](http://stackoverflow.com/a/17363466/4600127). – Verzweifler Jun 03 '15 at 13:11