Hello,
I am having trouble with the following code:
I get a subscript out of range error for the lines marked in red (InnerColor and OuterColor). When I remove the (1)s and (0)s or change .text to .value, I get a type mismatch error.
Help is much appreciated. Thank you in advance!
I am having trouble with the following code:
Code:
Private Sub CODE_Change()
Dim ws As Worksheet
Dim fm As Worksheet
Set ws = Worksheets(ActiveSheet.Name)
Set fm = Worksheets("Form")
Dim range0 As Range, res As Variant
Set range0 = Worksheets(ActiveSheet.Name).Range("A1:P1000").Columns(1)
res = Application.Match(CODE.Text, range0, 0)
If Not IsError(res) Then
Set range1 = range0.Cells(res, 1)
AddData.Enabled = False
EditData.Enabled = True
CheckBox1.Enabled = False
PROJECT.Text = range1.offset(0, 1)
COMPONENT.Text = range1.offset(0, 3)
CRITERIA.Text = range1.offset(0, 4)
ITEM.Text = range1.offset(0, 2)
DEVELOPERNAME.Text = range1.offset(0, 9)
NUMBOARDS.Text = range1.offset(0, 5)
VENDOR.Text = range1.offset(0, 7)
PLANT.Text = range1.offset(0, 8)
[COLOR=#ff0000]InnerColor.Text = Trim(Split(Trim(Split(range1.offset(0, 9).[COLOR=#ff0000]Text[/COLOR], ";")(1)), ":")(1))
OuterColor.[COLOR=#ff0000]Text[/COLOR] = Trim(Split(Trim(Split(range1.offset(0, 9).[COLOR=#ff0000]Text[/COLOR], ";")(0)), ":")(1))
[/COLOR]
Else
AddData.Enabled = True
EditData.Enabled = False
CheckBox1.Enabled = True
End If
SendEmail.Enabled = False
SaveForm.Enabled = False
End Sub
I get a subscript out of range error for the lines marked in red (InnerColor and OuterColor). When I remove the (1)s and (0)s or change .text to .value, I get a type mismatch error.
Help is much appreciated. Thank you in advance!