Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
How could I select a range in macro if I don't know how many columns I have, meaning my columns is variable. Example: Range("A1:A4").select Need help. TIA Eric |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Eric,.
Range("A1").Resize(1, Cells(1, Columns.Count).End(xlToLeft).Column).Select -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Eric" wrote in message ... Hi, How could I select a range in macro if I don't know how many columns I have, meaning my columns is variable. Example: Range("A1:A4").select Need help. TIA Eric |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Eric,
Just noticed that you said variable columns, but your example showed variable rows. If it should be rows, try Range("A1").Resize(Cells(Rows.Count,"A").End(xlUp) .Row,1).Select -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Bob Phillips" wrote in message ... Eric,. Range("A1").Resize(1, Cells(1, Columns.Count).End(xlToLeft).Column).Select -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Eric" wrote in message ... Hi, How could I select a range in macro if I don't know how many columns I have, meaning my columns is variable. Example: Range("A1:A4").select Need help. TIA Eric |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you could try something like
Range("A:A").select should wor -- Message posted from http://www.ExcelForum.com |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
'select columns:
set rng = Range(cells(1,1),cells(1,256).End(xltoleft)) rng.Select 'select rows: set rng = Range(cells(1,1),Cells(rows.count,1).End(xlup)) rng.Select -- Regards, Tom Ogilvy "Eric" wrote in message ... Hi, How could I select a range in macro if I don't know how many columns I have, meaning my columns is variable. Example: Range("A1:A4").select Need help. TIA Eric |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need help writing Excel macro when range changes | Excel Worksheet Functions | |||
macro to copy from excel range to word doc | Excel Discussion (Misc queries) | |||
Help with Dynamically changing Range in Excel Macro | Excel Discussion (Misc queries) | |||
How do I set up a formula with a changing range in an excel macro | Excel Discussion (Misc queries) | |||
Using a macro to set a range name in EXCEL | Excel Programming |