Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Select filled region only in non-adjacent columns
I have just selected the non-hidden cells in several non-adjacent columns.
Now I want to select these columns only from row 1 to the maximum occupied row. How do I do it? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Select filled region only in non-adjacent columns
This code has been tested and works. I highlight multiple cells by holding
the Ctrl keys while selecting the cells. Had data in 5 different columns which were non-adjacent. Sub selectrows() first = True For Each cell In Selection mycolumn = cell.Column If first = True Then Lastrow = Cells(Rows.Count, cell.Column).End(xlUp).Row Set selectedRange = Range(Cells(1, cell.Column), _ Cells(Lastrow, cell.Column)) first = False Else Lastrow = Cells(Rows.Count, cell.Column).End(xlUp).Row Set selectedRange = Union(selectedRange, _ Range(Cells(1, cell.Column), Cells(Lastrow, cell.Column))) End If Next cell selectedRange.Select End Sub "hmm" wrote: I have just selected the non-hidden cells in several non-adjacent columns. Now I want to select these columns only from row 1 to the maximum occupied row. How do I do it? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Select an item from dropdown list but return value from adjacent c | Excel Discussion (Misc queries) | |||
Set cell to record date when adjacent cell is filled AND NOT RESET | Excel Worksheet Functions | |||
My pivot table does not accept select non-adjacent columns? | Excel Discussion (Misc queries) | |||
Select a range of non-adjacent cells in Excel? | Excel Worksheet Functions | |||
I have a formula that copies itself when adjacent cells are filled in. How? | Excel Discussion (Misc queries) |