Hi, I am using the code below to show the last row of data in a list box from the active sheet but I can only get it to show the first row and I only need to it to show the last row of data can anyone help.
Regards
VBA Code:
Private Sub OptionButton1_Click()
If OptionButton1.Value = True Then
Set ws = ActiveSheet
lastrow = ws.Range("N" & Rows.Count).End(xlUp).row + 1
ws.Range("N" & lastrow).Value = ("IN")
End If
lastrow = Sheet1.Range("A1").CurrentRegion.Rows.Count
Select Case lastrow
Case Is <= 1: Set ws = ActiveSheet.Range("A2:I" & lastrow)
Case Is > 1: Set ws = ActiveSheet.Range("A" & lastrow - 1, "I" & lastrow)
End Select
Me.ListBox1.RowSource = ws.Address
Set ws = Nothing
End Sub
Regards