Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default "Double Click" macro?

Is there a way to create a macro that if you double click on a cell or row it
will activate a worksheet. Example would be:

If cell A1 is double clicked, or at least activated and "submitted" using a
Command Button, the result would be:

Worksheets ("12").Activate

See I have 94 rows of assembly descriptions on a worksheet
[Worksheets("Start")], and 94 other worksheets that have a Bill Of Materials.
I would like to have a person be able to highlight a cell or row and it
brings up the correct BOM. A double click would be easiest on the end user
but I think an active row or cell with a Command Button is more achievable.

Any help is greatly appreciated. Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default "Double Click" macro?

Here is a double-click example. Once installed, if you double click on B9 it
takes you to another sheet:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Set t = Target
Set r = Range("B9")
If Intersect(t, r) Is Nothing Then Exit Sub
Sheets("Sheet1").Activate
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200907


"Cerberus" wrote:

Is there a way to create a macro that if you double click on a cell or row it
will activate a worksheet. Example would be:

If cell A1 is double clicked, or at least activated and "submitted" using a
Command Button, the result would be:

Worksheets ("12").Activate

See I have 94 rows of assembly descriptions on a worksheet
[Worksheets("Start")], and 94 other worksheets that have a Bill Of Materials.
I would like to have a person be able to highlight a cell or row and it
brings up the correct BOM. A double click would be easiest on the end user
but I think an active row or cell with a Command Button is more achievable.

Any help is greatly appreciated. Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default "Double Click" macro?

Great, thank you!

"Gary''s Student" wrote:

Here is a double-click example. Once installed, if you double click on B9 it
takes you to another sheet:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Set t = Target
Set r = Range("B9")
If Intersect(t, r) Is Nothing Then Exit Sub
Sheets("Sheet1").Activate
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200907


"Cerberus" wrote:

Is there a way to create a macro that if you double click on a cell or row it
will activate a worksheet. Example would be:

If cell A1 is double clicked, or at least activated and "submitted" using a
Command Button, the result would be:

Worksheets ("12").Activate

See I have 94 rows of assembly descriptions on a worksheet
[Worksheets("Start")], and 94 other worksheets that have a Bill Of Materials.
I would like to have a person be able to highlight a cell or row and it
brings up the correct BOM. A double click would be easiest on the end user
but I think an active row or cell with a Command Button is more achievable.

Any help is greatly appreciated. Thanks in advance.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default "Double Click" macro?

You are very welcome, but also consider using a hyperlink to accomplish the
same thing. The hyperlink only needs a single click (you see I am very lazy!)
--
Gary''s Student - gsnu200907


"Cerberus" wrote:

Great, thank you!

"Gary''s Student" wrote:

Here is a double-click example. Once installed, if you double click on B9 it
takes you to another sheet:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Set t = Target
Set r = Range("B9")
If Intersect(t, r) Is Nothing Then Exit Sub
Sheets("Sheet1").Activate
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200907


"Cerberus" wrote:

Is there a way to create a macro that if you double click on a cell or row it
will activate a worksheet. Example would be:

If cell A1 is double clicked, or at least activated and "submitted" using a
Command Button, the result would be:

Worksheets ("12").Activate

See I have 94 rows of assembly descriptions on a worksheet
[Worksheets("Start")], and 94 other worksheets that have a Bill Of Materials.
I would like to have a person be able to highlight a cell or row and it
brings up the correct BOM. A double click would be easiest on the end user
but I think an active row or cell with a Command Button is more achievable.

Any help is greatly appreciated. Thanks in advance.

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 Double click a blank cell to enact "ctrl + ;" Emredrum Excel Worksheet Functions 10 October 16th 08 10:30 PM
Excel: can "go to adjacent empty cell" double-click be disabled? dgg2006 Excel Discussion (Misc queries) 1 April 8th 06 04:51 AM
excel status bar says "double-click to edit PBrush" leo Excel Worksheet Functions 2 April 7th 06 04:08 PM
status bar says "double-click to edit pbrush" leo Excel Discussion (Misc queries) 0 April 6th 06 07:37 PM
I have to double click a cell for the "text" format to take Charles Excel Discussion (Misc queries) 2 January 24th 06 02:46 PM


All times are GMT +1. The time now is 09:54 PM.

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

About Us

"It's about Microsoft Excel"