Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default using cell names in vb code

excel 2000
trying to reference changed cells by their cell name in a case statement
with no luck
code is something like this, have tried target.range, target.name, etc
can't seem to find the right combination of target as and select case

Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case Target.Range
Case Target.Range("cellName1"), Target.Range("cellName2"), etc
or
Select Case Target.name
Case Target.name("cellName1"), Target.name("cellName2"), etc

i'm thinking there is some way to do this, yes??????


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 301
Default using cell names in vb code

Try this:
Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error Resume Next 'in case target does NOT have a name!
Select Case Target.Name.Name 'yes, .Name.Name!
Case "CellName1", "CellName2"
.....
Case "MyName3"
...
End Select
End Sub

Bob Umlas
Excel MVP
"bbxrider" wrote in message
...
excel 2000
trying to reference changed cells by their cell name in a case statement
with no luck
code is something like this, have tried target.range, target.name, etc
can't seem to find the right combination of target as and select case

Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case Target.Range
Case Target.Range("cellName1"), Target.Range("cellName2"), etc
or
Select Case Target.name
Case Target.name("cellName1"), Target.name("cellName2"), etc

i'm thinking there is some way to do this, yes??????




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default using cell names in vb code

name.name is bizare but works, thanks a lot

"Bob Umlas" wrote in message
...
Try this:
Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error Resume Next 'in case target does NOT have a name!
Select Case Target.Name.Name 'yes, .Name.Name!
Case "CellName1", "CellName2"
.....
Case "MyName3"
...
End Select
End Sub

Bob Umlas
Excel MVP
"bbxrider" wrote in message
...
excel 2000
trying to reference changed cells by their cell name in a case statement
with no luck
code is something like this, have tried target.range, target.name, etc
can't seem to find the right combination of target as and select case

Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case Target.Range
Case Target.Range("cellName1"), Target.Range("cellName2"), etc
or
Select Case Target.name
Case Target.name("cellName1"), Target.name("cellName2"), etc

i'm thinking there is some way to do this, yes??????






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
using the Excel generic worksheet names instead of user-given names in code Paul Excel Discussion (Misc queries) 5 June 26th 09 08:44 PM
Code names for excel sheets alan82 Excel Discussion (Misc queries) 5 April 21st 09 01:52 PM
Sheet names code Jonah Excel Discussion (Misc queries) 8 November 4th 06 03:03 AM
Counting names thru code Tom Jameson Excel Programming 2 November 19th 03 08:13 PM
Use VBE Sheet names in code Tom Ogilvy Excel Programming 0 November 10th 03 04:50 PM


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