CrispyAsian
Board Regular
- Joined
- Sep 22, 2017
- Messages
- 64
Hey all,
I'm working on this code but everytime I run it, I get a subscript error on the .Value lines. I don't know what I'm doing wrong.
I have the Select Case in there because I am going to be adding more option to what ComboBox2 could be equal to, but I want to get this part fixed before I do so. Anybody see what I'm not?
I'm working on this code but everytime I run it, I get a subscript error on the .Value lines. I don't know what I'm doing wrong.
Code:
Private Sub ComboBox2_Change()
Range("F3:PO3").Clear
Dim SDates() As String
Dim CDates As String
Dim c As Range
Select Case ComboBox2
Case Is = "AF CTSAC"
For Each c In Worksheets("Sheet2").Range("B2:AZ2")
If Not c Is Nothing Then
CDates = Cells(2, c.Column).Value
SDates = Split(CDates, " - ")
Worksheets("Sheet1").Cells(21, 1).Value = SDates(0) 'These two lines are where I get the Subscript out of range error
Worksheets("Sheet1").Cells(21, 2).Value = SDates(1)
Else
End If
Next c
End Select
End Sub
I have the Select Case in there because I am going to be adding more option to what ComboBox2 could be equal to, but I want to get this part fixed before I do so. Anybody see what I'm not?