ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   select a variable range (https://www.excelbanter.com/excel-programming/355468-select-variable-range.html)

evil baby[_15_]

select a variable range
 

I want to select coloums A-BR of different rows in a loop.


How do I setup the Range (A[some_number]:BR[some_number]).select

the number will change a few times and wont be the same everytime I run
the macro


--
evil baby
------------------------------------------------------------------------
evil baby's Profile: http://www.excelforum.com/member.php...o&userid=31983
View this thread: http://www.excelforum.com/showthread...hreadid=520237


Justin Philips

select a variable range
 
Something like this but change your do while to what you need.

Dim x, y As Single

x = 1
y = 1

Do While Range("B" & x).Value < ""
Range("A" & x & ":AR" & y).Select
x = x + 1
y = y + 1
Loop


Jim Thomlinson

select a variable range
 
Try something like this

dim lngThisNumber as long
dim lngThatNumber as long

lngThisNumber = 1
lngThatNumber = 12345

range(cells(lngThisNumber, "A"), cells(lngThatNumber, "BR").Select
--
HTH...

Jim Thomlinson


"evil baby" wrote:


I want to select coloums A-BR of different rows in a loop.


How do I setup the Range (A[some_number]:BR[some_number]).select

the number will change a few times and wont be the same everytime I run
the macro


--
evil baby
------------------------------------------------------------------------
evil baby's Profile: http://www.excelforum.com/member.php...o&userid=31983
View this thread: http://www.excelforum.com/showthread...hreadid=520237



Tom Ogilvy

select a variable range
 
for i = 1 to 20
cells(i,1).Resize(1,70).Select
msgbox selection.Address
Next

--
Regards,
Tom Ogilvy


"evil baby" wrote
in message ...

I want to select coloums A-BR of different rows in a loop.


How do I setup the Range (A[some_number]:BR[some_number]).select

the number will change a few times and wont be the same everytime I run
the macro


--
evil baby
------------------------------------------------------------------------
evil baby's Profile:

http://www.excelforum.com/member.php...o&userid=31983
View this thread: http://www.excelforum.com/showthread...hreadid=520237




evil baby[_16_]

select a variable range
 

Thanks for the help again

I ended up using

Range("A" & x, "L" & x).Select

and just setting x to activecell


--
evil baby
------------------------------------------------------------------------
evil baby's Profile: http://www.excelforum.com/member.php...o&userid=31983
View this thread: http://www.excelforum.com/showthread...hreadid=520237



All times are GMT +1. The time now is 10:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com