Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Produce the name of the named range of activecell

Hi Excel users and expert,

Excel 2002 SP3.

I swear I have seen the answer to this but Google search did not get me
there.

I'm looking for code that does this:

If active cell is in named range Data1 then call Macro1
elseif activecell is in named range Data2 then call Macro2
End If

"activecell.name.name" did not work but I have to missing something. Gotta
be fairly simple.

I have 9 ranges and macros but I'm sure if I can get the syntax of the 2
above I can work it out.

Thanks,
Regards,
Howard


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Produce the name of the named range of activecell

Hi Howard,

One way:

'=============
Public Sub Tester001()

Dim rng1 As Range
Dim rng2 As Range

On Error Resume Next
Set rng1 = Intersect(ActiveCell, Range("Data1"))
Set rng2 = Intersect(ActiveCell, Range("Data2"))
On Error GoTo 0

If Not rng1 Is Nothing Then
Call Macro1
ElseIf Not rng2 Is Nothing Then
Macro2
Else
'do nothing
End If

End Sub
'<<=============


---
Regards,
Norman



"L. Howard Kittle" wrote in message
...
Hi Excel users and expert,

Excel 2002 SP3.

I swear I have seen the answer to this but Google search did not get me
there.

I'm looking for code that does this:

If active cell is in named range Data1 then call Macro1
elseif activecell is in named range Data2 then call Macro2
End If

"activecell.name.name" did not work but I have to missing something.
Gotta be fairly simple.

I have 9 ranges and macros but I'm sure if I can get the syntax of the 2
above I can work it out.

Thanks,
Regards,
Howard



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Produce the name of the named range of activecell

Thanks, Norm, exactly what I was looking for. Having seen your code, I am
now sure I have not seen something like that previously. But, looking it
over it all makes sense, but I would not have figured it out myself.

Thanks again, much appreciated.

Regards,
Howard

"L. Howard Kittle" wrote in message
...
Hi Excel users and expert,

Excel 2002 SP3.

I swear I have seen the answer to this but Google search did not get me
there.

I'm looking for code that does this:

If active cell is in named range Data1 then call Macro1
elseif activecell is in named range Data2 then call Macro2
End If

"activecell.name.name" did not work but I have to missing something.
Gotta be fairly simple.

I have 9 ranges and macros but I'm sure if I can get the syntax of the 2
above I can work it out.

Thanks,
Regards,
Howard



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
produce a formulate to produce assigned seats for dinner DavidJoss Excel Worksheet Functions 0 October 4th 05 02:29 AM
If any cell in named range = 8 then shade named range JJ[_8_] Excel Programming 3 August 26th 05 11:09 PM
How to get name of named range where activecell is Tetsuya Oguma[_4_] Excel Programming 5 April 8th 05 11:13 AM
Copy named range contents to activecell position Neal Excel Programming 2 October 28th 04 02:20 PM
Finding if the activecell is withing a named range Seamus Conlon Excel Programming 8 August 28th 04 12:10 AM


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