![]() |
Parsing values into ranges
Hi - I am trying to increment a value in a range, as below. I get a message
saying "Expected list seperator or )" dim ii as int For ii = 7 To 19 Range("M" & str(ii):"S"+str(ii)).Select do stuff next Have tried changing & for + and taking out str... Any thoughts? Cheers Andrew |
Parsing values into ranges
The first problem you have is that the colon needs to go inside the
string: Range("M" & ii & ":S" & ii).Select The second problem is the Str() returns a value with a leading space (if positive) so M & Str(ii) returns "M 7" instead of "M7" As shown above, you can simply use the integer variable. OTOH, you could also do less string manipulation: For ii = 7 to 9 Range("M" & ii).Resize(1, 7).Select Next ii or For ii = 7 to 9 Cells(ii, 13).Resize(1, 7).Select Next ii etc. In article , "Andreww" wrote: Hi - I am trying to increment a value in a range, as below. I get a message saying "Expected list seperator or )" dim ii as int For ii = 7 To 19 Range("M" & str(ii):"S"+str(ii)).Select do stuff next Have tried changing & for + and taking out str... Any thoughts? Cheers Andrew |
All times are GMT +1. The time now is 11:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com