Hi
I am prototyping VBA code to use in a wider app that I am building using Excel 2003. Trying to understand Find / findnext methods etc. However, with code below, how can I obtain the address in row, col format rather than traditional "A3" format for example in aCell.Address?
many thanks in anticipation.
CODE
Dim strSearch As String
Dim aCell As Range
Dim oSht As Worksheet
On Error GoTo Err
Set oSht = Sheets("All")
'lastRow = oSht.Range("A" & Rows.Count).End(xlUp).Row
LastCol = oSht.Range("A1:H1").End(xlUp).Column
strSearch = "In LEA care"
Set aCell = oSht.Range("A1:H1").Find(What:=strSearch, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not aCell Is Nothing Then
MsgBox "Value Found in Cell " & aCell.Address
End If
Exit Sub
Err:
MsgBox Err.Description
/CODE
I am prototyping VBA code to use in a wider app that I am building using Excel 2003. Trying to understand Find / findnext methods etc. However, with code below, how can I obtain the address in row, col format rather than traditional "A3" format for example in aCell.Address?
many thanks in anticipation.
CODE
Dim strSearch As String
Dim aCell As Range
Dim oSht As Worksheet
On Error GoTo Err
Set oSht = Sheets("All")
'lastRow = oSht.Range("A" & Rows.Count).End(xlUp).Row
LastCol = oSht.Range("A1:H1").End(xlUp).Column
strSearch = "In LEA care"
Set aCell = oSht.Range("A1:H1").Find(What:=strSearch, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not aCell Is Nothing Then
MsgBox "Value Found in Cell " & aCell.Address
End If
Exit Sub
Err:
MsgBox Err.Description
/CODE