Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Active Workbook


With two open workbooks and knowing the name of one only (let's call th
one we know the name of wb1.xls), is there a way to make wb1.xls th
inactive workbook and make the other one (we don't know the name) th
active one???

thanks:

--
halem
-----------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...nfo&userid=993
View this thread: http://www.excelforum.com/showthread.php?threadid=55013

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Active Workbook

In a Module, try:

Sub aa()
If Workbooks(1).Name = "wb1" Then
Workbooks(2).Activate
Else
Workbooks(1).Activate
End If
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Active Workbook


the problem isI don't know the name of the other workbook until it is
emailed to me. I would need to edit the macro everytime if I use that
procedure.

I need to make the Active workbook the one I receive not wb1


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=550132

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Active Workbook


thanks. Tried it but doen not work

--
halem
-----------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...nfo&userid=993
View this thread: http://www.excelforum.com/showthread.php?threadid=55013

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Active Workbook

You said:

The workbook whose name you know is wkb1.xls; workbook(n).Name returns the
name of its workboom without extension xls.

The code has no reference to the name of the other workbook BUT it does
assume that you have it open in the same session of Excel.

Then the code works: it does what you asked for. That is make the 'other'
workbok the active workbook.

Did you ask for what you wanted?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Active Workbook


I think I did... The actual error says "subscript out of range..erro
9".

both workbooks have several worksheets, one over 90 and the other on
over 30. When the macro worked, it would (using another sub I have
match the ws names on both and copy the cell ranges from one to th
other, then go to the next matching set of ws and do the same until i
copied all specified cell ranges from all ws.

it baffles me that it actually worked for a few weeks and it jus
stopped working. No one else has access to it and it is passworded

--
halem
-----------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...nfo&userid=993
View this thread: http://www.excelforum.com/showthread.php?threadid=55013

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing Hidden Workbook when Active Workbook is Closed SusanK521 Excel Programming 5 September 24th 05 12:27 AM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM
How do I make an open workbook the active workbook Don Guillett[_4_] Excel Programming 0 December 30th 03 04:28 PM
Copy Modules from One workbook to Active Workbook Jim Gifford Excel Programming 1 November 18th 03 12:30 PM
Preventing opening workbook inside active workbook. Serge[_4_] Excel Programming 2 November 4th 03 07:51 PM


All times are GMT +1. The time now is 08:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"