Excel macro question
Category: Computers > Software
Asked by: macaonghus-ga
List Price: $2.00
24 Oct 2004 09:13 PDT
Expires: 23 Nov 2004 08:13 PST
Question ID: 419319
I am cycling through x = 1 to 100. I want to say something like For x = 1 to 100 Range("Jx").Select Next x so it selects J1 then J2 then J3 etc. How can I use a value (x) instead of hard coding 1,2,3,4,5 ..... Thank you.
Re: Excel macro question
Answered By: aht-ga on 24 Oct 2004 10:09 PDT
macaonghus-ga: In your specific example, you will want to use the Offset method of the Range class. The best reference for this is the Help file in Excel VBA, so bring up Help when you are editing your macro (hit F1 to bring it up), and just type "Offset" in the Index Search field. In your example, you would have: For x = 0 to 99 Range("J1").Offset(x,0).Select <your other code goes here> Next x That's all! Regards, aht-ga Google Answers Researcher
|macaonghus-ga rated this answer:|
|There are no comments at this time.|
If you feel that you have found inappropriate content, please let us know by emailing us at email@example.com with the question ID listed above. Thank you.
|Search Google Answers for|