Hello All,
Is it possible to put an argument from an array directly into command?
I get error "method or data member not found"
Speaking in examples:
i have simplified the values for the purpose of my question
i have userform (CmNm) with check boxes (BoxA, BoxB...)
after clicking on import button i want it to check if boxes in CmNm are ticked and for those that are to do the import
i get error on: CmNm.Box & Element
when i manually write CmNm.BoxA instead (while omitting the For command) it is working, but i have to do each array value manually
Code:
Dim cm, nm As String
Dim hotels
cm = Format(Date, "mmyy")
nm = Format(DateAdd("m", 1, Date), "mmyy")
letters = Array("A", "B", "C")
For Each Element In letters
If CmNm.Box & Element = True Then
Worksheets("Main").CheckBoxes(Element & cm) = 1
Worksheets("Main").CheckBoxes(Element & nm) = 1
Application.Run (Element & "Import")
End If
Next Element
End Sub
Thank you in advance,
Kind regards,
Wries