Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Brackets [] possibilities ?

Thanks,

But wy not [A1] = 6 ?

Still much shorter!

Alai

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Brackets [] possibilities ?

Thanks Chip and Rob!

Alai

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Constant Data to be used for different possibilities Cbdavis Excel Discussion (Misc queries) 3 November 10th 09 01:47 PM
Multiple Lookup Possibilities JeffH Excel Discussion (Misc queries) 1 May 8th 08 06:27 PM
Thousands of possibilities sharkfoot Excel Discussion (Misc queries) 5 March 27th 06 05:11 AM
Conditional w/ three possibilities MathDoctor Excel Discussion (Misc queries) 4 June 11th 05 03:45 PM
find the possibilities BlackBlade[_2_] Excel Programming 2 May 5th 04 08:58 AM


All times are GMT +1. The time now is 01:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"