View Single Post
 
Old 12-21-2010, 04:51 AM
BjornS BjornS is offline Windows Vista Office 2003
Competent Performer
 
Join Date: Jan 2010
Location: Sweden
Posts: 116
BjornS is on a distinguished road
Default Last row...

Hi,
to know the last row of the "state column" (AB) which is taken into account, there are a number of ways to get this info.

Either extend the existing macro by:
Cells(1, 1) = LastRow1
Put this just before "End Sub", then cell A1 of the sheet "Original" will show you the value.

You can also implement the additional macro below. In this version it gives a popup-message, showing the last column of the column you have activated.
By removing the remark symbol of the command "ActiveCell.Value = LastRow1", you can also have the value written in the current cell (whatever fits you best).

Kind regards
Bjorn


Sub LastRow()
Dim LastRow1 As Long
Dim i As integer

With ActiveSheet
LastRow1 = .Cells(.Rows.Count, ActiveCell.Column).End(xlUp).Row
End With

i = MsgBox("Last Row for this column is " & LastRow1, vbOKOnly + vbInformation)

' ActiveCell.Value = LastRow1

End Sub
Reply With Quote