cocopops2001
Board Regular
- Joined
- Apr 18, 2011
- Messages
- 112
hey there, i have a workbook which is a sort of MENU/Database of various calculation sheets and for the most part it works fine.
what the book does is allows the user to select which calculation sheet they want and then click a button which asks the user what they want done with the sheet.
they have the option of creating a new book (works fine with no problems), opening an existing(closed) book(works fine too) or using a book that is already open(doesnt work so well).
these options are called fron a userform which has a dropdown box for the open files and a few buttons for the other functions. how do i switch to the open work book?
below is the code for the OK button which they push after selecting the open workbook
it worked fine when the OK button just showed a msgbox but now i want it to do somethin it becomes unstuck. i have also tried
which gives me the message about opening an already open file and that i might lose my changes.
have tried
and
and
the sheet in the new book does not matter, as long it is selected and becomes the active book the rest of the macro works.
please help
what the book does is allows the user to select which calculation sheet they want and then click a button which asks the user what they want done with the sheet.
they have the option of creating a new book (works fine with no problems), opening an existing(closed) book(works fine too) or using a book that is already open(doesnt work so well).
these options are called fron a userform which has a dropdown box for the open files and a few buttons for the other functions. how do i switch to the open work book?
below is the code for the OK button which they push after selecting the open workbook
Code:
Private Sub CommandButton1_Click()
Dim Myfile As String
Myfile = ComboBox1.Value
'''opens new book
Myfile.Sheets(1).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
it worked fine when the OK button just showed a msgbox but now i want it to do somethin it becomes unstuck. i have also tried
Code:
workbooks.open myfile
have tried
Code:
workbooks.activate myfile
Code:
workbooks.select myfile
Code:
myfile.sheet(1).activate
please help