I am trying to read the data directly from an Excel file into a text box. i keep getting this error OBJECT REQUIRED
here is my code:
the error is on line 6 but basically it's every line that has .range in it.
here is my code:
Code:
Private Sub CboMS_AfterUpdate()
With worksheets = ("C:\todays\Small Pricing.xls")
If Me.CboMS.ListIndex <> -1 Then
'MsgBox ("[" & Me.CboMonth & "]")
MsgBox ("[" & .range("D16").Value & "]")
Select Case Me.CboMS.ListIndex
Case 0
Select Case Me.CboZS.ListIndex
Case 0
Me.txt_6MS = .range("D15").Value
Case 1
Me.txt_6MS = .range("D16").Value
Case 2
Me.txt_6MS = .range("D17").Value
Case 3
Me.txt_6MS = .range("D18").Value
Case 4
Me.txt_6MS = .range("D19").Value
End Select
'i have some code in here different
End Select
End If
End With
End Sub
Comment