I don't understand why the above error pops up when I run this code.
This code worked in another work sheet so I have no idea why it's not working here. The only thing I changed is the inner for lop. On the sheet that worked the oTextBox was shp defined as a shape and Texboxes was Shapes. But I can't do that in the current worksheet as there are charts and i don't want to check charts.
VBA Code:
Sub Update_Labels()
'
' Update_Labels Macro
'
Dim rStart As RANGE
Dim shp As Shape
Dim sFind As String
Dim sTemp As String
RANGE("A1").Select
Set rStart = ActiveCell
'search for textboxes
For x = 0 To (59)
sFind = "Bulb" & RANGE("L" & 164 + x) & " "
If RANGE("O" & 164 + x) = True Then
For Each oTextBox In ActiveSheet.TextBoxes
shp.Select
sTemp = shp.TextFrame.Characters.Text
On Error Resume Next
If InStr(LCase(sTemp), LCase(sFind)) <> 0 Then
oTextBox.Select
Selection.Text = "Bulb" & RANGE("L" & 164 + x) & " " & vbCrLf & RANGE("M" & 164 + x) & vbCrLf & RANGE("N" & 164 + x)
End If
Next
End If
Next x
RANGE("A1").Select
'
End Sub