Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i set an entire row or column to a range?
hi,
how do i set an entire row or an entire column to a range? thanks -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i set an entire row or column to a range?
You're gonna laugh:
set rng = Range("A1").EntireColumn or set rng = Range("A1").EntireRow And they call it BASIC?? -Brad -----Original Message----- hi, how do i set an entire row or an entire column to a range? thanks! --- Message posted from http://www.ExcelForum.com/ . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i set an entire row or column to a range?
Hi,
Is this what you are looking for? Sub SetRanges() Dim rng As Range MsgBox "First the column... " Set rng = Range("G:G") rng.Select MsgBox "and now the row... " Set rng = Range("20:20") rng.Select MsgBox "and now back to home. " Range("A1").Select End Sub I hope that helps. Rick -----Original Message----- hi, how do i set an entire row or an entire column to a range? thanks! --- Message posted from http://www.ExcelForum.com/ . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i set an entire row or column to a range?
what if i only know of the column number (or row number) based on an int
value in a field called colNum? for example - if in my code the logic determines that the range needs to be 3 (meaning colNum = 3) i'm getting an error "Method 'Range' of object '_Global' failed." with the statement: Set rngWs = Range(colNum).EntireColumn Thanks! --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i set an entire row or column to a range?
Use:
Set rngWs = Cells(1,ColNum).EntireColumn HTH Otto "strataguru" wrote in message ... what if i only know of the column number (or row number) based on an int value in a field called colNum? for example - if in my code the logic determines that the range needs to be 3 (meaning colNum = 3) i'm getting an error "Method 'Range' of object '_Global' failed." with the statement: Set rngWs = Range(colNum).EntireColumn Thanks! --- Message posted from http://www.ExcelForum.com/ |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i set an entire row or column to a range?
Set rngWs = Columns(colNum).Cells
set rngWs = Rows(rowNum).Cells if you don't use the cells, you will get a range object of size 1 (the entire column or entire row). Same with the other suggested approached Set rngWs = cells(1,colNum).EntireColumn ? rngWs.count 1 so if you were going to loop through the cells of the column, you wouldn't. If you were going to insert a column or set the column width, then you could proceed without using the cells qualifier. -- Regards, Tom Ogilvy strataguru wrote in message ... what if i only know of the column number (or row number) based on an int value in a field called colNum? for example - if in my code the logic determines that the range needs to be 3 (meaning colNum = 3) i'm getting an error "Method 'Range' of object '_Global' failed." with the statement: Set rngWs = Range(colNum).EntireColumn Thanks! --- Message posted from http://www.ExcelForum.com/ |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i set an entire row or column to a range?
try
Sub setcol() Set wsrng = Columns(1) wsrng.Select End Sub -- Don Guillett SalesAid Software "strataguru" wrote in message ... what if i only know of the column number (or row number) based on an int value in a field called colNum? for example - if in my code the logic determines that the range needs to be 3 (meaning colNum = 3) i'm getting an error "Method 'Range' of object '_Global' failed." with the statement: Set rngWs = Range(colNum).EntireColumn Thanks! --- Message posted from http://www.ExcelForum.com/ |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do i set an entire row or column to a range?
Very good to know that Tom. I would have lost some more hair if I tried to
loop through the cells. Otto "Tom Ogilvy" wrote in message ... Set rngWs = Columns(colNum).Cells set rngWs = Rows(rowNum).Cells if you don't use the cells, you will get a range object of size 1 (the entire column or entire row). Same with the other suggested approached Set rngWs = cells(1,colNum).EntireColumn ? rngWs.count 1 so if you were going to loop through the cells of the column, you wouldn't. If you were going to insert a column or set the column width, then you could proceed without using the cells qualifier. -- Regards, Tom Ogilvy strataguru wrote in message ... what if i only know of the column number (or row number) based on an int value in a field called colNum? for example - if in my code the logic determines that the range needs to be 3 (meaning colNum = 3) i'm getting an error "Method 'Range' of object '_Global' failed." with the statement: Set rngWs = Range(colNum).EntireColumn Thanks! --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Count Unique Values in a entire column, not just range | Excel Worksheet Functions | |||
When entering data into a range of cells, select the entire range. | Excel Discussion (Misc queries) | |||
If data in one column, take date, add 2 days, and turn the entire column a color... | Excel Discussion (Misc queries) | |||
my column is sorted in two sections. How do I sort entire column? | Excel Discussion (Misc queries) | |||
my column is sorted in two sections. How do I sort entire column? | Excel Discussion (Misc queries) |