Dear Expert out there,
Need a great help from you. Currently I have created a macro which has a input prompt whereby user need to key in the sheet name as shown below. If I do not want the input prompt and instead want the user to key in the sheet name in a particular excel cell and then link it to my macro, how am I suppose to do it?
Thanks in advance for your help!
[Dim lr As Long, r As Long
Dim ws As Worksheet
Dim wsName As String
wsName = InputBox("Input your sheet name")
On Error Resume Next
Set ws = Sheets(wsName)
On Error GoTo 0
If ws Is Nothing Then
MsgBox wsName & " is not a valid sheet name for this workbook"
Else
With ws
lr = .Cells(.Rows.Count, "C").End(xlUp).Row
For r = lr To 1 Step -1
' Classify - REPATRIATION
If .Range("C" & r) Like "*REPAT*" Or .Range("C" & r) Like "*SOUTH SHADY*" Then
.Range("E" & r).Copy Destination:=.Range("F" & r)
End If]
Need a great help from you. Currently I have created a macro which has a input prompt whereby user need to key in the sheet name as shown below. If I do not want the input prompt and instead want the user to key in the sheet name in a particular excel cell and then link it to my macro, how am I suppose to do it?
Thanks in advance for your help!
[Dim lr As Long, r As Long
Dim ws As Worksheet
Dim wsName As String
wsName = InputBox("Input your sheet name")
On Error Resume Next
Set ws = Sheets(wsName)
On Error GoTo 0
If ws Is Nothing Then
MsgBox wsName & " is not a valid sheet name for this workbook"
Else
With ws
lr = .Cells(.Rows.Count, "C").End(xlUp).Row
For r = lr To 1 Step -1
' Classify - REPATRIATION
If .Range("C" & r) Like "*REPAT*" Or .Range("C" & r) Like "*SOUTH SHADY*" Then
.Range("E" & r).Copy Destination:=.Range("F" & r)
End If]