Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have 6 columns of data. I need to find the bottom, right-most cell (I
don't know what row that is since it changes from worksheet to worksheet) and then select the whole area from A4 to this last cell. The problem is that there is no guarantee that all cells will have data in them (so the x1end command will stop before reaching my desired cell). Well, to be precise, columns A, B and C are all populated but D, E and F only have intermittent entries. Once I have that range, I need to use it in a Range(MyRange).AdvancedFilter Action:=xlFilterInPlace, Unique:=True Instruction so I need to assign this changing area to a variable, MyRange. Thanks in advance |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As long as column A is fully populated this will work fine for the selection
of the range. Range("A4:F4", Range("A4:F4").End(xlDown)).Select Cheers, Jeff "NikkoW" wrote in message ble.rogers.com... I have 6 columns of data. I need to find the bottom, right-most cell (I don't know what row that is since it changes from worksheet to worksheet) and then select the whole area from A4 to this last cell. The problem is that there is no guarantee that all cells will have data in them (so the x1end command will stop before reaching my desired cell). Well, to be precise, columns A, B and C are all populated but D, E and F only have intermittent entries. Once I have that range, I need to use it in a Range(MyRange).AdvancedFilter Action:=xlFilterInPlace, Unique:=True Instruction so I need to assign this changing area to a variable, MyRange. Thanks in advance |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nikko, another approach in case you can't guarantee which column is the
longest or if it has no blanks: dim R as long, N as long for I = 1 to 6 R = cells(65536,i).end(xlup) if R N then N = R next Range(range("a4"), cells(N,6)).select Bob Flanagan Macro Systems http://www.add-ins.com Productivity add-ins and downloadable books on VB macros for Excel "NikkoW" wrote in message ble.rogers.com... I have 6 columns of data. I need to find the bottom, right-most cell (I don't know what row that is since it changes from worksheet to worksheet) and then select the whole area from A4 to this last cell. The problem is that there is no guarantee that all cells will have data in them (so the x1end command will stop before reaching my desired cell). Well, to be precise, columns A, B and C are all populated but D, E and F only have intermittent entries. Once I have that range, I need to use it in a Range(MyRange).AdvancedFilter Action:=xlFilterInPlace, Unique:=True Instruction so I need to assign this changing area to a variable, MyRange. Thanks in advance |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In a regular Module:
Sub GetLastRealCell() Dim RealLastRow As Long Dim RealLastColumn As Long Range("A1").Select On Error Resume Next RealLastRow = _ Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row RealLastColumn = _ Cells.Find("*", [A1], , , xlByColumns, xlPrevious).Column MsgBox "The Last Populated Cell in this Worksheet is " & Cells(RealLastRow, RealLastColumn).Address End Sub "NikkoW" wrote in message ble.rogers.com... I have 6 columns of data. I need to find the bottom, right-most cell (I don't know what row that is since it changes from worksheet to worksheet) and then select the whole area from A4 to this last cell. The problem is that there is no guarantee that all cells will have data in them (so the x1end command will stop before reaching my desired cell). Well, to be precise, columns A, B and C are all populated but D, E and F only have intermittent entries. Once I have that range, I need to use it in a Range(MyRange).AdvancedFilter Action:=xlFilterInPlace, Unique:=True Instruction so I need to assign this changing area to a variable, MyRange. Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
key detection in user forms | Excel Discussion (Misc queries) | |||
Directory and File Detection | Excel Discussion (Misc queries) | |||
Color detection | Excel Worksheet Functions | |||
Detection of VBA code | Excel Programming | |||
Automatic detection of a change in a column/cell | Excel Programming |