HockeyDiablo
Board Regular
- Joined
- Apr 1, 2016
- Messages
- 182
Trying to run a quick script to pull a few names out of a string and place them in the column next to the string location. Cant seem to get this going. Any tips would be greatly appreciated.
Sub james()
Dim celltxt As String
celltxt = ActiveSheet.Range("d4").Text
If InStr(1, celltxt, "Sue") Then
Range("e4").Value = "Sue"
ElseIf InStr(1, celltxt, "Kari") Then
Range("e4").Value = "Kari"
ElseIf InStr(1, celltxt, "Holly") Then
Range("e4").Value = "Holly"
Else
MsgBox ("error")
james2
End If
End Sub
Sub james2()
Dim celltxt2 As String
celltxt = ActiveSheet.Range("d4").Text
If InStr(1, celltxt2, "Sue") And Range("e4").Value <> "Sue" Then
Range("g4").Value = "Sue"
ElseIf InStr(1, celltxt2, "Kari") And Range("e4").Value <> "Kari" Then
Range("g4").Value = "Kari"
ElseIf InStr(1, celltxt2, "Holly") And Range("e4").Value <> "Holly" Then
Range("g4").Value = "Holly"
Else
End If
End Sub
Thanks again.
James
Sub james()
Dim celltxt As String
celltxt = ActiveSheet.Range("d4").Text
If InStr(1, celltxt, "Sue") Then
Range("e4").Value = "Sue"
ElseIf InStr(1, celltxt, "Kari") Then
Range("e4").Value = "Kari"
ElseIf InStr(1, celltxt, "Holly") Then
Range("e4").Value = "Holly"
Else
MsgBox ("error")
james2
End If
End Sub
Sub james2()
Dim celltxt2 As String
celltxt = ActiveSheet.Range("d4").Text
If InStr(1, celltxt2, "Sue") And Range("e4").Value <> "Sue" Then
Range("g4").Value = "Sue"
ElseIf InStr(1, celltxt2, "Kari") And Range("e4").Value <> "Kari" Then
Range("g4").Value = "Kari"
ElseIf InStr(1, celltxt2, "Holly") And Range("e4").Value <> "Holly" Then
Range("g4").Value = "Holly"
Else
End If
End Sub
Thanks again.
James