Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi OssieMac
Thanks for the code with the If/Else/Endif safety added. Just what I needed. -- Thank you Aussie Bob C Little cost to carry knowledge with you. Win XP P3 Office 2007 on Mini Mac using VMware. "OssieMac" wrote: Hello Aussie Bob, Whether you use the If/Else/EndIf is up to you but I should think that you would not want code selecting the range if you have not previously selected a cell in the correct column. Having said that, normally with code it is not necessary to actually select ranges but not knowing what you are doing with the code it is hard to advise the best way for your particular case. Sub SelectSpecific() Dim lastRow As Long With ActiveSheet If ActiveCell.Column = Columns("A").Column Then lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row .Range(ActiveCell, .Cells(lastRow, "N")).Select Else MsgBox "Activecell not in column A" End If End With End Sub -- Regards, OssieMac "Aussie Bob C" wrote: From Leith Ross 2/7/2006 Dim EndCell As Range Set EndCell = ActiveSheet.Cells(Rows.Count, "A").End(xlUp) ActiveSheet.Range(ActiveCell, EndCell).ClearContents If I change the A to an N it selects a range from ActiveCell down to last entry in Column N. My ActiveCell is in Column A but Column N may not have data down to the last cell as in Column A How do I select a range of cells from an ActiveCell in column A across to Column N and down to last data cell in column A -- Thank you Aussie Bob C Little cost to carry knowledge with you. Win XP P3 Office 2007 on Mini Mac using VMware. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Select range of cells in column AS based upon lastcell in col A. | Excel Programming | |||
Select ActiveCell Range | Excel Programming | |||
ActiveCell.Row in Range().Select? | Excel Programming | |||
select range next to activecell | Excel Programming | |||
Select Activecell in Range | Excel Programming |