CaptainCsaba
Board Regular
- Joined
- Dec 8, 2017
- Messages
- 78
Hi!
I am trying to select the last cell in column A that contains numbers with the thousand separators eg 1,234,567. Previously in one of my other codes I used "*#,#*" but here it does not seem to work. If I write anything instead it perfectly finds it but not like this. What am I missing?
I am trying to select the last cell in column A that contains numbers with the thousand separators eg 1,234,567. Previously in one of my other codes I used "*#,#*" but here it does not seem to work. If I write anything instead it perfectly finds it but not like this. What am I missing?
Code:
Sub SelectLastCell()Dim lr, i, n As Long
lr = Cells(Rows.Count, 1).End(xlUp).Row
Application.ScreenUpdating = False
For i = lr To 2 Step -1
On Error Resume Next
n = WorksheetFunction.Search("*#,#*", Cells(i, 1))
If Err = 0 Then
Cells(i, 1).Select
Exit For
End If
Next i
Application.ScreenUpdating = True
End Sub