View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default How do I select this range using code....another try at it.

Maybe this will help ... though by starting a new thread we don't get to see
what you've already been offered as potential solutions.

Sub LastRow_AtoD()
Dim LastRow As Long
LastRow = Application.WorksheetFunction.Max _
(Range("A65536").End(xlUp).Row, _
Range("B65536").End(xlUp).Row, _
Range("C65536").End(xlUp).Row, _
Range("D65536").End(xlUp).Row)
Range("A1:E" & LastRow).Select
MsgBox LastRow
End Sub

Regards

Trevor


"TBA" wrote in message
...
I have four columns that represent the various parts of a road name. The
respective headers are, in order, Prefix, RdName, Suffix and PostDir.

The headers occupy cells A1 through D1.

A user will copy relevant data into this sheet, with cell A2 being the

first
cell that could potentially contain data. Most often cell A2 will NOT
contain a value.

It is likely that one of the four columns will contain no data at all
(except for the header).

It is equally likely that there will be sections where there is no data at
all for several rows in a row.

What I need to do:

I need to be able to select the range from cell A2 to E? where the ?
represents the last row number that contains a value.

John Wilson and Per Erik both offered advice in a previous post, but

neither
method worked.

TIA.

-gk-