Aug 28, 2001 Current running macro's workbook or worksheet name. I actually keep the workbook name in the variable. However, I have two procedure to execute the macro. Jun 08, 2017 Workbook.Activate method (Excel); 2 minutes to read +1; In this article. Activates the first window associated with the workbook. Expression A variable that represents a Workbook object. This method won't run any AutoActivate or AutoDeactivate macros that might be attached to the workbook (use.
- Excel Macro Active Workbook Close
- Excel Macro Activate Current Workbook Free
- Excel Macro Activate Current Workbooks
- Excel Macro Enabled Workbook Extension
How do I activate my Other workbook from the Current workbook? I have a current workbook with dumb.xls and The other workbook name as Tire.xls.I have opened the Tire.xls from the dumb.xls using worksbooks.open filename:= 'name of the file'.Its getting open but The problem is Im unable to make it work. If I say cells(2,24).value=24 puts these value in the cell of dumb.xls but I want it to be. Aug 20, 2015 Currently within my VB I have Windows('FileA.xls').Activate This is no good as the file name will change depending upon which book I have open, but I want the macro to run on the active book (I will specify sheet which is the same in all books) I want to activate current Book.
Active6 months ago
How do I activate my Other workbook from the Current workbook? I have a current workbook with dumb.xls and The other workbook name as Tire.xls.I have opened the Tire.xls from the dumb.xls using
worksbooks.open filename:= 'name of the file'
.Its getting open but The problem is Im unable to make it work.If I say
cells(2,24).value=24
puts these value in the cell of dumb.xls but I want it to be done one Tire.xls.activesheet.cells(2,24).value=24
puts these on Tire.xls. But how do i activate the Workbook with the name ? I need to open 3 to 4 excel workbooks And perform the operation? How do I activate the specific workbook I have found this code on google
Its not getting activated. I dont know how to make it work. Can anyone tell me How do i activate a specific workbook and a specific sheet of the other workbook ?
Example: I have niko.xls and niko_2.xls opened as workbooks from the dumb.xls workbook so totally 3 workbooks and I have to activate the 2nd sheet of niko_2.xls workbook.How do I make it? Can anyone explain me the syntax with these example? Thank you in advance
Jean-François Corbett29.6k2222 gold badges114114 silver badges165165 bronze badges
nikoniko5,5692222 gold badges6969 silver badges119119 bronze badges
6 Answers
You do not need to activate the sheet (you'll take a huge performance hit for doing so, actually). Since you are declaring an object for the sheet, when you call the method starting with 'wb.' you are selecting that object. For example, you can jump in between workbooks without activating anything like here:
aevankoaevanko12.9k33 gold badges4545 silver badges5353 bronze badges
You have to set a reference to the workbook you're opening. Then you can do anything you want with that workbook by using its reference.
Could even set a reference to the sheet, which will make life easier later:
Others have pointed out that
Jean-François CorbettJean-François Corbett.Activate
may be superfluous in your case. You don't strictly need to activate a sheet before editing its cells. But, if that's what you want to do, it does no harm to activate -- except for a small hit to performance which should not be noticeable as long as you do it only once or a few times. However, if you activate many times e.g. in a loop, it will slow things down significantly, so activate should be avoided. 29.6k2222 gold badges114114 silver badges165165 bronze badges
JoniaJonia
pinckerman3,57155 gold badges2727 silver badges3939 bronze badges
MNSMNS
To know the sheets name to refer in
Wb.Sheets('sheetname')
you can use the following :Excel Macro Active Workbook Close
shareef5,63699 gold badges4646 silver badges7474 bronze badges
Tim WilliamsTim Williams97.5k99 gold badges7272 silver badges8989 bronze badges
Pang7,2591616 gold badges6868 silver badges108108 bronze badges
KaiKai
Not the answer you're looking for? Browse other questions tagged excelvbaexcel-vba or ask your own question.
-->Activates the first window associated with the workbook.
Syntax
expression.Activate
Excel Macro Activate Current Workbook Free
expression A variable that represents a Workbook object.
Remarks
This method won't run any Auto_Activate or Auto_Deactivate macros that might be attached to the workbook (use the RunAutoMacros method to run those macros).
Example
This example activates Book4.xls. If Book4.xls has multiple windows, the example activates the first window, Book4.xls:1.
Excel Macro Activate Current Workbooks
Support and feedback
Excel Macro Enabled Workbook Extension
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.