I have a macro named Splittext
that is called when there is a change in cell "B4" of sheet Macro Process
it doesn't work when I call it but it works when I manually run it. There is no error in the code
Sub splitText()
Dim wsS1 As Worksheet 'Sheet1
Dim textstring As String, warray() As String, counter As Integer, strg As String
Set wsS1 = Sheets("OUTPUT 1")
wsS1.Activate
textstring = Range("A2").Value
warray() = Split(textstring, ">")
For counter = LBound(warray) To UBound(warray)
strg = warray(counter)
Cells(counter + 3, 1).Value = Trim(strg)
Next counter
textstring = Range("B2").Value
warray() = Split(textstring, ">")
For counter = LBound(warray) To UBound(warray)
strg = warray(counter)
Cells(counter + 3, 2).Value = Trim(strg)
Next counter
textstring = Range("C2").Value
warray() = Split(textstring, ">")
For counter = LBound(warray) To UBound(warray)
strg = warray(counter)
Cells(counter + 3, 3).Value = Trim(strg)
Next counter
End Sub
This code is supposed to separate the text present in the Cells ("A2")("B2")("C2") of sheet "OUTPUT 1"
This is how I am calling the code
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Set Target = Range("B4")
If Target.Value = "Completed" Then
Call splitText
End If
End Sub