Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear experts,
I am trying to determine within my open workbooks the one that contains the sheet "Instructions", workbook that I would like to activate. My code (not working!) is the following: i = 0 Do i = i + 1 Loop Until IsError(Workbooks(i).Worksheets("Instructions")) = False Workbooks(i).Activate WBReport = Workbooks(i).Name Could you please help me? Many thanks! Best regards, -- Valeria |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Function ActivateInstructions() As String
' Will activate the worksheet "Instructions" ' Returns the name of the workbook containing the sheet "Instructions" ' Note: If there happens to be more than one workbook with a sheet called "Instructions" this will activate and return the one opened most recently. ' If no book contains a sheet called "Instructions" function returns an empty string Dim WB As Workbook ActivateInsrtuctions = "" For Each WB In Application.Workbooks On Error GoTo NoInstructions WB.Worksheets("Instructions").Activate ActivateInstructions = WB.Name NoInstructions: On Error GoTo 0 Next WB End Function -- - K Dales "Valeria" wrote: Dear experts, I am trying to determine within my open workbooks the one that contains the sheet "Instructions", workbook that I would like to activate. My code (not working!) is the following: i = 0 Do i = i + 1 Loop Until IsError(Workbooks(i).Worksheets("Instructions")) = False Workbooks(i).Activate WBReport = Workbooks(i).Name Could you please help me? Many thanks! Best regards, -- Valeria |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy value from active sheet to another workbook | New Users to Excel | |||
Consolidation of data from cell in active sheet of closed workbook | Excel Worksheet Functions | |||
Open Specific Sheet in Workbook | Excel Programming | |||
Auto Populate sheet name of active workbook in Combobox in Command | Excel Programming | |||
Reliably get sheet 1 of the active workbook | Excel Programming |