![]() |
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 |
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 |
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 |
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 |
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? |
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 |
All times are GMT +1. The time now is 02:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com