Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Clicking cells - run VBA

I have a Workbook full of worksheets with bank account details - the first
sheet is an Index sheet with a summary of the various accounts worksheets -
I want to select the appropriate worksheet and display it when I click (or
maybe double click) the account name on the Index sheet - can I do that ?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Clicking cells - run VBA

Right click on the Index Sheet tab (i.e., on the sheet's name (e.g.
Sheet1) and select ViewCode. Then VBE will open.
put this code in the
Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
On Error GoTo NoSuchSheet:
ThisWorkbook.Worksheets(CStr(Target.Value)).Activa te
ExitSub:
On Error GoTo 0
Exit Sub
NoSuchSheet:
MsgBox "There is no such Sheet in this file!"
Resume ExitSub:
End Sub



On Jan 26, 2:00*pm, Isis wrote:
I have a Workbook full of worksheets with bank account details - the first
sheet is an Index sheet with a summary of the various accounts worksheets -
I want to select the appropriate worksheet and display it when I click (or
maybe double click) the account name on the Index sheet - can I do that ?

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Clicking cells - run VBA

AB wrote in
:

Right click on the Index Sheet tab (i.e., on the sheet's name (e.g.
Sheet1) and select ViewCode. Then VBE will open.
put this code in the
Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
On Error GoTo NoSuchSheet:
ThisWorkbook.Worksheets(CStr(Target.Value)).Activa te
ExitSub:
On Error GoTo 0
Exit Sub
NoSuchSheet:
MsgBox "There is no such Sheet in this file!"
Resume ExitSub:
End Sub



On Jan 26, 2:00*pm, Isis wrote:
I have a Workbook full of worksheets with bank account details - the
firs

t
sheet is an Index sheet with a summary of the various accounts
worksheets

-
I want to select the appropriate worksheet and display it when I
click (o

r
maybe double click) the account name on the Index sheet - can I do
that ?

Thanks




Thanks AB, that was a help.

If I wanted to link to sheets in other workbooks is there an adaptation I
can make ?

Thanks again
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default Clicking cells - run VBA

Try using hyperlinks. No VBA needed.

Best wishes Harald

"Isis" wrote in message
...
I have a Workbook full of worksheets with bank account details - the first
sheet is an Index sheet with a summary of the various accounts
worksheets -
I want to select the appropriate worksheet and display it when I click (or
maybe double click) the account name on the Index sheet - can I do that ?

Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Clicking cells - run VBA

On 26 Jan 2011 14:00:47 GMT, Isis wrote:

I have a Workbook full of worksheets with bank account details - the first
sheet is an Index sheet with a summary of the various accounts worksheets -
I want to select the appropriate worksheet and display it when I click (or
maybe double click) the account name on the Index sheet - can I do that ?

Thanks


My no code required solution is to simply use hyperlinks...

You can make "hyperlinks" and then point at "a location in this file"
and select the sheet. That hyperlink can be copied down the page,
replacing your index entries. You must then edit the other hyperlinks to
match what they should point to.

Another way, my personal favorite... is to go to a specific cell in
each sheet and give that cell a name (range name) That name could be the
account name or other cryptic naming schema you decide upon.

Then, when you make the hyperlinks, you simply point at the range name
for each sheet, and it will "pop" you right there instantly.

I have a 52 week example on the Microsoft user submitted template
website. There are "Jump Links" that take the user to any of the 52
worksheets, OR any of the 52 Data Charts for those worksheets.

Of course, the tabs are available as well, but the links all have
custom wording, and even have custom "comments" that pop up when you
hover over the link describing what it will do or where it will go.


http://tinyurl.com/27zvzv4


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Clicking cells - run VBA

Yesh. :-) I posted a link to an example on the MS template site.

The blood pressure tracker there also uses hyperlinks as "jump links".


On Wed, 26 Jan 2011 18:39:56 +0100, "Harald Staff"
wrote:

Try using hyperlinks. No VBA needed.

Best wishes Harald

"Isis" wrote in message
...
I have a Workbook full of worksheets with bank account details - the first
sheet is an Index sheet with a summary of the various accounts
worksheets -
I want to select the appropriate worksheet and display it when I click (or
maybe double click) the account name on the Index sheet - can I do that ?

Thanks

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Clicking cells - run VBA

Then i'd suggest you go with the hyperlink solution others brought up.
That's because with the code then, the sheet name isn't enough anymore
- along with the sheet (account) name you'll need to put down in the
index sheet also the workbook name and perhaps also its location
(depending how well structured your file system is).
Of course, tt can be done and perhaps it wouldn't be too much of a
hastle but the Hyperlinks might be just more elegan solution unless
you find it more laboursome.


On Jan 26, 3:10*pm, Isis wrote:
AB wrote :





Right click on the Index Sheet tab (i.e., on the sheet's name (e.g.
Sheet1) and select ViewCode. Then VBE will open.
put this code in the
Option Explicit


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
* * On Error GoTo NoSuchSheet:
* * * * ThisWorkbook.Worksheets(CStr(Target.Value)).Activa te
ExitSub:
* * On Error GoTo 0
* * Exit Sub
NoSuchSheet:
* * * * MsgBox "There is no such Sheet in this file!"
* * * * Resume ExitSub:
End Sub


On Jan 26, 2:00*pm, Isis wrote:
I have a Workbook full of worksheets with bank account details - the
firs

t
sheet is an Index sheet with a summary of the various accounts
worksheets

*-
I want to select the appropriate worksheet and display it when I
click (o

r
maybe double click) the account name on the Index sheet - can I do
that ?


Thanks


Thanks AB, that was a help.

If I wanted to link to sheets in other workbooks is there an adaptation I
can make ?

Thanks again- Hide quoted text -

- Show quoted text -


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
HOW TO EDIT CELLS WITHOUT DOUBLE CLICKING THE BOX Chris Price Excel Discussion (Misc queries) 2 April 22nd 23 12:11 PM
Excel - prevent someone from clicking into certain cells Silverstreak Excel Discussion (Misc queries) 1 January 21st 10 02:01 PM
Problem when clicking on cells for a formula BigGSim Excel Discussion (Misc queries) 1 February 19th 08 10:16 PM
Clicking on linked cells PT[_2_] Excel Worksheet Functions 2 November 17th 07 03:49 AM
Problem with clicking on cells Gabriel B Excel Discussion (Misc queries) 2 January 11th 06 11:50 PM


All times are GMT +1. The time now is 11:28 PM.

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"