Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Brackets [] possibilities ?
Hi,
If I want to put the number 6 in the cell A1 up to now I was doing i this way: Range("A1").Select ActiveCell.FormulaR1C1 = 6 I learn from one post here that I can do it much more easily this way: [A1] = 6 As long as I just want to put a specific value in one particular cell should I do it this way? Thanks Alai -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Brackets [] possibilities ?
Hi
try =Range("A1").value=6 -- Regards Frank Kabel Frankfurt, Germany Hi, If I want to put the number 6 in the cell A1 up to now I was doing it this way: Range("A1").Select ActiveCell.FormulaR1C1 = 6 I learn from one post here that I can do it much more easily this way: [A1] = 6 As long as I just want to put a specific value in one particular cell, should I do it this way? Thanks Alain --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Brackets [] possibilities ?
Thanks,
But wy not [A1] = 6 ? Still much shorter! Alai -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Brackets [] possibilities ?
Alain,
In some MS documentation (I forget the URL, probably somewhere in MSDN), it was noted that using the [] syntax is significantly slower than using the Range() syntax. I suspect, but don't know for a fact, that everything inside the [] is unknown to the compiler at compile time, and has to be resolved at run time. This causes extra code to be generated at compile time and executed at run time. You should never use the syntax in your first example: Range("A1").Select ActiveCell.FormulaR1C1 = 6 There is no reason to Select the range before operating upon it, and Select is an expensive operation. Instead, combine the two lines in to a single line of code like Range("A1").Value = 6 Performance issues aside, whether to use the [] syntax is a matter of personal taste. I don't like it (I'm not sure why I don't like it, but I don't), so I always use the Range() syntax. If you read the posts of the professional developers in this newsgroup, you'll find that nearly everyone uses the Range() syntax over the [] syntax. However, you are free to develop a coding style that suits you. Whichever you choose, be consistent; don't mix and match reference styles. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "alainB " wrote in message ... Hi, If I want to put the number 6 in the cell A1 up to now I was doing it this way: Range("A1").Select ActiveCell.FormulaR1C1 = 6 I learn from one post here that I can do it much more easily this way: [A1] = 6 As long as I just want to put a specific value in one particular cell, should I do it this way? Thanks Alain --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Brackets [] possibilities ?
You could do it this way and it would be faster than doing .Select
Range("A1").Value = 6 is faster than [A1] = 6 though. -- Rob van Gelder - http://www.vangelder.co.nz/excel "alainB " wrote in message ... Hi, If I want to put the number 6 in the cell A1 up to now I was doing it this way: Range("A1").Select ActiveCell.FormulaR1C1 = 6 I learn from one post here that I can do it much more easily this way: [A1] = 6 As long as I just want to put a specific value in one particular cell, should I do it this way? Thanks Alain --- Message posted from http://www.ExcelForum.com/ |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Brackets [] possibilities ?
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Constant Data to be used for different possibilities | Excel Discussion (Misc queries) | |||
Multiple Lookup Possibilities | Excel Discussion (Misc queries) | |||
Thousands of possibilities | Excel Discussion (Misc queries) | |||
Conditional w/ three possibilities | Excel Discussion (Misc queries) | |||
find the possibilities | Excel Programming |