I have a procedure that calls other procedures from Personal workbook based on text string in cell A2.
It works perfect for the first sheet, but it wont loop the sheet. After the code runs for the first sht I get an "Application-defined or object-defined error.
what do I do wrong?
Sub TextToColumns()
Dim sht As Worksheet
For Each sht In ActiveWorkbook.Worksheets
If sht.Range("A2") Like "*NEW: NR255.P1BAIBKR.P190BEL.WRK03*" Then
Application.Run "Personal.xlsb!Felix310"
ElseIf sht.Range("A2").Value Like "*OLD: NR255.P1BAIBKR.P310BEL.MEL03*" Then
Application.Run "Personal.xlsb!KVH_310"
ElseIf sht.Range("A").Value Like "*OLD: NR255.P1BAIBKR.P190BEL.MEL02*" Then
Application.Run "Personal.xlsb!KVH_Felix"
End If
Next
End Sub
It works perfect for the first sheet, but it wont loop the sheet. After the code runs for the first sht I get an "Application-defined or object-defined error.
what do I do wrong?
Sub TextToColumns()
Dim sht As Worksheet
For Each sht In ActiveWorkbook.Worksheets
If sht.Range("A2") Like "*NEW: NR255.P1BAIBKR.P190BEL.WRK03*" Then
Application.Run "Personal.xlsb!Felix310"
ElseIf sht.Range("A2").Value Like "*OLD: NR255.P1BAIBKR.P310BEL.MEL03*" Then
Application.Run "Personal.xlsb!KVH_310"
ElseIf sht.Range("A").Value Like "*OLD: NR255.P1BAIBKR.P190BEL.MEL02*" Then
Application.Run "Personal.xlsb!KVH_Felix"
End If
Next
End Sub