![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
MrExcel MVP, Administrator
Join Date: Feb 2002
Location: The act or process of locating.
Posts: 13,679
|
...however, I don't know how to write VBA code. What I'm using, I got help with from here.
(I had all of this typed already, but apparently my login expired...grr...anyway...) The code I'm currently using opens 2 separate workbooks and prompts for the others to open. I usually start entering information in a certain workbook every time. How can I set it to switch to this one workbook after it opens the one I select? Thanks! |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Put the following code in the workbook that you don't want active:
Private Sub Workbook_Open() Workbooks("BookToActivate.xls").Activate End Sub
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
MrExcel MVP, Administrator
Join Date: Feb 2002
Location: The act or process of locating.
Posts: 13,679
|
Thanks, Al, but I have a little question about that.
After the macro runs, the workbook that I selected to open is the one that stays on top. This is not always the same workbook. Would I have to put that in every workbook that I might have to open? I honestly was assuming there would be some kind of command somewhere to look at what files are open and bring this certain one to the front, as it were. Hitting ctrl+tab to flip through them isn't really a big pain or anything, I was just hoping there was a way around it. |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
How about the following code:
For Each w In Workbooks If w.Name = "NameOfBookToActivate.xls" Then w.Activate End If Next w
__________________
Kind regards, Al Chara |
|
|
|
|
|
#5 |
|
MrExcel MVP, Administrator
Join Date: Feb 2002
Location: The act or process of locating.
Posts: 13,679
|
Would that one go into the existing code?
(Just checking, but I can't try it now until Monday) |
|
|
|
|
|
#6 |
|
Join Date: Mar 2002
Posts: 372
|
"There are two means of adding to the miseries of life: music and cats." - C. O. Jones
|
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Post your code and I will integrate it.
|
|
|
|
|
|
#8 | |
|
MrExcel MVP, Administrator
Join Date: Feb 2002
Location: The act or process of locating.
Posts: 13,679
|
Al,
This is what I currently have: Quote:
Thanks for all of your help, _________________ Kristy "There are two means of refuge from the miseries of life: music and cats." - Albert Schweitzer [ This Message was edited by: Von Pookie on 2002-03-25 06:43 ] |
|
|
|
|
|
|
#9 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi Kristy
Can't you just put: Workbooks("BookIWant.xls").Activate as the last line of your "code" ? |
|
|
|
|
|
#10 | |
|
MrExcel MVP, Administrator
Join Date: Feb 2002
Location: The act or process of locating.
Posts: 13,679
|
Quote:
1) Judging by the tone, you seem to assume that I know how to use VBA...which I don't (unfortunately). That's why I'm posting for help. 2) I went ahead and tried your suggestion in several different places of the code...I couldn't get it to work. However, I'm assuming that it's just me that's the problem. Thanks, |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|