ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Activating Worksheets and Importing Data from them (https://www.excelbanter.com/excel-programming/303854-re-activating-worksheets-importing-data-them.html)

Tom Ogilvy

Activating Worksheets and Importing Data from them
 
if the checkbox is an activeX checkbox. Assume the workbook to open is
named "C:\Myfiles\3Years.xls"

Private Sub Checkbox1_Click()
Dim wkbk as Workbook
if me.Checkbox1.Value = True then
' check if 3Years is already open
on Error Resume Next
set wkbk = Workbooks("3Years.xls")
On Error goto 0
if wkbk is nothing then
' it wasn't open, so open it
set wkbk = Workbooks.Open("C:\MyFiles\3Years.xls")
End if
wkbk.Activate
' checkbox1 is for the first sheet
' adjust here for the other checkboxes/sheets
wkbk.worksheets(1).Activate
End if

End Sub

copy the above event for the other two checkboxes and make the indicated
adjustments (activate sheets 2 and 3 respectively)

--
Regards,
Tom Ogilvy

"Johnny Yakoo" <Johnny wrote in message
...
What I'd like help with please, is as follows:
- i have one master file with three check-boxes on 1 worksheet
- those check boxes correspond to adjacent cells for a particular year
- those 3 years correspond to another workbook with 3 tabs, one for each

year

I would like to be able to click on one of the boxes for a given year in

the main file, which will open the workbook with all three years and then
select the appropriate year worksheet.

I would greatly appreciate help on this issue.

JY





All times are GMT +1. The time now is 07:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com