cocopops2001
Board Regular
- Joined
- Apr 18, 2011
- Messages
- 112
i have a userform with a dropdown box which allows a user to select an open workbook, when they click OK some code runs.
when they click OK without a file selected i get a runtime error 13, type mismatch.
what do i have to add to tell it to do nothing if a file is not selected.
i am thinking something like:
the code for the button click is here
thanks
when they click OK without a file selected i get a runtime error 13, type mismatch.
what do i have to add to tell it to do nothing if a file is not selected.
i am thinking something like:
Code:
if myfile = "" then
'''its this bit i dont know what to write.
the code for the button click is here
Code:
Private Sub CommandButton1_Click()
Dim Myfile As String
Myfile = ComboBox1.Value
'''opens new book
Workbooks(Myfile).Activate
'''''checks if cover sheet exists and if not creates one
covercheck
''''copies desired sheet
ThisWorkbook.ActiveSheet.Range("a11:n70").Copy
'''''copies desired sheet
sheetcopy
UserForm3.Hide
End Sub
thanks