Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Another last cell detection problem

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
key detection in user forms AlanGriffithKapitiNZ Excel Discussion (Misc queries) 0 June 22nd 09 05:13 PM
Directory and File Detection Varne Excel Discussion (Misc queries) 3 November 18th 08 11:46 AM
Color detection Dan wilson Excel Worksheet Functions 3 March 31st 05 03:51 PM
Detection of VBA code Chris Gorham[_3_] Excel Programming 2 November 1st 03 09:00 PM
Automatic detection of a change in a column/cell Adrian Nightingale Excel Programming 1 September 1st 03 01:09 PM


All times are GMT +1. The time now is 02:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"