J
Junior728
Hi,
Pls see my example of the macro that i did. My intention is to find in
column G, cells that has either values of "AS", "HC" or "50", if found , then
for column P in the same row, it will return that value. But it does not
work. i tried to use selection.find but i cannot multi find, so i use
select...case instead.
Can anyone advise my mistake in my macro below?
e.g.
Sub Testing()
Dim Result As String
Dim CheckVal As String
Range("A1").Select
NumOfRows = Cells(Rows.Count, "1").End(xlUp).Row
CheckVal = ActiveSheet.Cells(CurrentRow, 7) 'Column G
Result = ActiveSheet.Cells(CurrentRow, 16) 'Column P
For CurrentRow = 1 To NumOfRows
Select Case UCase(CheckVal)
Case "AS"
Result = "AS"
Case "50"
Result = "50"
Case "HC"
Result = "HC"
Case Else
Result = "" 'equals to blank
End Select
Next
MsgBox ("Done!!!Thanks for Playing!!!")
End Sub
Pls see my example of the macro that i did. My intention is to find in
column G, cells that has either values of "AS", "HC" or "50", if found , then
for column P in the same row, it will return that value. But it does not
work. i tried to use selection.find but i cannot multi find, so i use
select...case instead.
Can anyone advise my mistake in my macro below?
e.g.
Sub Testing()
Dim Result As String
Dim CheckVal As String
Range("A1").Select
NumOfRows = Cells(Rows.Count, "1").End(xlUp).Row
CheckVal = ActiveSheet.Cells(CurrentRow, 7) 'Column G
Result = ActiveSheet.Cells(CurrentRow, 16) 'Column P
For CurrentRow = 1 To NumOfRows
Select Case UCase(CheckVal)
Case "AS"
Result = "AS"
Case "50"
Result = "50"
Case "HC"
Result = "HC"
Case Else
Result = "" 'equals to blank
End Select
Next
MsgBox ("Done!!!Thanks for Playing!!!")
End Sub