Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Right-mouse open a 2nd file to a particular sheet that correspondswith a 1st file's sheet

I have 2 files: FileA and FileB. FileA is an office. FileB is a help file used to explain data in FileA. Both have 10 sheets.

Here is what I hope to accomplish. If I am viewing FileA, Sheet 3, I want to right mouse and have FileB open to its Sheet 3. Likewise, I need this corresponding action for all 10 sheets. I am using Excel 2003. Is this possible? Any suggested macro would be appreciated. Thanks.

Michael
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default Right-mouse open a 2nd file to a particular sheet that corresponds with a 1st file's sheet

michaelrlanier wrote:

I have 2 files: FileA and FileB. FileA is an office. FileB is a help
file used to explain data in FileA. Both have 10 sheets.

Here is what I hope to accomplish. If I am viewing FileA, Sheet 3, I
want to right mouse and have FileB open to its Sheet 3. Likewise, I need
this corresponding action for all 10 sheets. I am using Excel 2003. Is
this possible? Any suggested macro would be appreciated. Thanks.


Put this in FileA's ThisWorkbook object:

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, _
ByVal Target As Range, Cancel As Boolean)
Workbooks("FileB").Activate
Workbooks("FileB").Sheets(Sh.Name).Activate
Cancel = True
End Sub

Note that if an appropriately-named sheet isn't in FileB you'll get an error
(Error 9, "Subscript out of range"). You can change Sheets(Sh.Name) to
something else to get around that, but I'll leave that as an exercise for the
student. (In other words, I can't remember how offhand, and I'm too tired to
bother investigating.)

Note also (important!) that this will completely prevent the right-click menu
from ever showing in FileA unless you use the keyboard.

--
Well, we headed back to the Slums to check on the local hive
of scum and villainy. It's a good practice, you know. Keeps
the scum and villainy on its toes and all that.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Right-mouse open a 2nd file to a particular sheet thatcorresponds with a 1st file's sheet

Thank you Auric. You have been quite helpful.

Michael
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
Why does a Multi-sheet/user file open on sheet two every time? Frustrated in NJ Excel Discussion (Misc queries) 1 January 22nd 10 05:46 PM
How to consolidate 580 file's data in 1 sheet without oppening all Amit Mahar Excel Worksheet Functions 1 April 23rd 09 01:36 PM
my file's format changes when i open the file on another computer gracek Excel Discussion (Misc queries) 1 February 14th 07 05:24 PM
Lookup on a sheet so that every time when file open it copes data from another file sheet Anna Excel Programming 1 December 19th 06 02:02 AM
shortcut to open file in personal.xls blocking file's macros No Name Excel Programming 1 June 14th 05 01:08 AM


All times are GMT +1. The time now is 05:53 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"