Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Call a macro or sub based on the name of a cell?

the name is useful only in "documenting" the case statement - so do it the
easy way:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

Select Case target.Address

Case Range("Board1").address
' do something

Case Range("House2").Address
' do something else

End Select



End Sub


--
Regards,
Tom Ogilvy


Jack Labonte wrote in message
om...
Hi,

I have about 20 named cells and I want to to execute a sub based on
the name of the cell. For example, a user double-clicks on a cell and
they get prompted for an input box based on the needs for the
calculation for the cell. I know I can trap the address but that's too
hard to keep track of. So far I've tried trapping with
target.name.name like so:


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

on error resume next

Select Case target.name.name

Case is = Worksheets("Drawings").Range("Board1")

'Do something...

End Select

End Sub


Is there any way to do something based on the cell name rather than
the cell address?

Thanks,

JL



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Call a macro or sub based on the name of a cell?

Works great. Thanks Tom.

Jack

"Tom Ogilvy" wrote in message ...
the name is useful only in "documenting" the case statement - so do it the
easy way:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

Select Case target.Address

Case Range("Board1").address
' do something

Case Range("House2").Address
' do something else

End Select



End Sub


--
Regards,
Tom Ogilvy


Jack Labonte wrote in message
om...
Hi,

I have about 20 named cells and I want to to execute a sub based on
the name of the cell. For example, a user double-clicks on a cell and
they get prompted for an input box based on the needs for the
calculation for the cell. I know I can trap the address but that's too
hard to keep track of. So far I've tried trapping with
target.name.name like so:


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

on error resume next

Select Case target.name.name

Case is = Worksheets("Drawings").Range("Board1")

'Do something...

End Select

End Sub


Is there any way to do something based on the cell name rather than
the cell address?

Thanks,

JL

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
Excel code to call a macro when a certain value in a cell isselected. [email protected] Excel Worksheet Functions 4 February 15th 08 08:18 PM
Call up worksheet based on validated list SAP PoD Excel Discussion (Misc queries) 5 August 18th 06 08:54 AM
VBA to call file based on date fLiPMoD£ Excel Discussion (Misc queries) 2 April 23rd 05 09:24 PM
Call a macro or sub based on the name of a cell? steve Excel Programming 0 August 25th 03 10:39 PM


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