Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default What is wrong with this code to name a worksheet range

Worksheets(aWS).Names.Add Name:="PlusMinusCount", RefersTo:="="&count

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default What is wrong with this code to name a worksheet range

What's 'aWS' and 'count'

Regards,
Peter T

"Barb Reinhardt" wrote in message
...
Worksheets(aWS).Names.Add Name:="PlusMinusCount", RefersTo:="="&count

Thanks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default What is wrong with this code to name a worksheet range

aWS is the activesheet.
Count is an integer variable that's defined earlier in the code.

"Peter T" wrote:

What's 'aWS' and 'count'

Regards,
Peter T

"Barb Reinhardt" wrote in message
...
Worksheets(aWS).Names.Add Name:="PlusMinusCount", RefersTo:="="&count

Thanks





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default What is wrong with this code to name a worksheet range

I just want to confirm that this named reage is intended to be attached to
the sheet and not the entire workbook. You will not see this named range from
other sheets...

There really is nothing terribly wrong with your code. I would not use count
as a varaible since it is a reserved word (a property of a bunch of different
objects) . Try this code...

dim aWS as worksheet
dim lCount as long

lcount = 10
set aWS = Activesheet

aWS.Names.Add Name:="
Activesheet.).Names.Add Name:="PlusMinusCount", RefersTo:= "=" & lcount

--
HTH...

Jim Thomlinson


"Barb Reinhardt" wrote:

Worksheets(aWS).Names.Add Name:="PlusMinusCount", RefersTo:="="&count

Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default What is wrong with this code to name a worksheet range

Your original code expects 'aWS' to be a string, ie the name of a worksheet
in the implicitly referenced Activeworkbook, though not necessarily the
activesheet.

If you've already set a reference to the activesheet, which is what you say
aWS is, -

aWS.Names.Add Name:="PlusMinusCount", RefersTo:="="&count

In passing probably better not name variables same as key-names, such as
'count'

Regards,
Peter T



"Barb Reinhardt" wrote in message
...
aWS is the activesheet.
Count is an integer variable that's defined earlier in the code.

"Peter T" wrote:

What's 'aWS' and 'count'

Regards,
Peter T

"Barb Reinhardt" wrote in

message
...
Worksheets(aWS).Names.Add Name:="PlusMinusCount",

RefersTo:="="&count

Thanks







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
What is wrong with this code? jlclyde Excel Discussion (Misc queries) 5 January 9th 08 05:12 PM
wrong code? minostrada Excel Programming 6 October 26th 05 02:50 PM
What's wrong with this code? PhilipsBernard Excel Programming 4 October 20th 05 07:30 AM
What's wrong with the code,pls hv a look changeable[_4_] Excel Programming 1 November 3rd 04 02:57 AM
Code for naming worksheet name range?? Sandy[_3_] Excel Programming 2 September 7th 03 04:49 AM


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