![]() |
Variable usage in Range Command
Help please
When using the Range("B1:B50").Select I want to substitute a variable into the Range. I have a variable which is a number e.g test=50 Therefore the command I want is Range(B1:B'test'").Select I cannot get the syntax right. Idea is to select a range of data based on variables. Is this the right way? Cheers David |
Variable usage in Range Command
David,
Range("B1:B" & test) hth, Doug Glancy "DavidC" wrote in message ... Help please When using the Range("B1:B50").Select I want to substitute a variable into the Range. I have a variable which is a number e.g test=50 Therefore the command I want is Range(B1:B'test'").Select I cannot get the syntax right. Idea is to select a range of data based on variables. Is this the right way? Cheers David |
Variable usage in Range Command
David,
Since the argument of the Range object is a string, you can manipulate it just as you would any other string: TestRng = "B1:B"&test Range(TestRng) or just Range("B1:B"&test) Good luck! -- David "DavidC" wrote in message ... Help please When using the Range("B1:B50").Select I want to substitute a variable into the Range. I have a variable which is a number e.g test=50 Therefore the command I want is Range(B1:B'test'").Select I cannot get the syntax right. Idea is to select a range of data based on variables. Is this the right way? Cheers David |
All times are GMT +1. The time now is 09:42 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com