Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Defining ranges in VB code

Hi Rachael,

I have also tried
ActiveWorkBook.Names.Add Name:strRangeName,
RefersTo:=strRefersTo

No matter what I try I can not define named ranges


Make that:

ActiveWorkBook.Names.Add Name:strRangeName,
RefersToR1C1:=Activeworkbook.Activesheet.Range(str StartOfRange & ":" &
sreEndOfRange)

Note that by defining these names the "old" names (to the other sheets)
will be overwritten.

NB: Download my name manager from my website!

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Defining ranges in VB code

Code seems OK except that we have to add the "=" to RefersTo, therefor
(partial) :-

RefersToR1C1:="=" & Application.Activesheet.Range(strStartOfRange & ":
& sreEndOfRange)

Don't need ActiveWorkbook because ActiveSheet is at application leve
too. Cannot check further without seeing your data. You could put
line in to check :-

Msgbox(ActiveSheet.Range(strRangeName).Address

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Defining ranges in VB code

Hi BrianB,

Code seems OK except that we have to add the "=" to RefersTo, therefore
(partial) :-


You are right, I made a mistake.

This should do it:

Activesheet.Range(strStartOfRange & ":" &
sreEndOfRange).Name=strRangeName

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

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
Defining Multiple "named" data ranges for Piot Tables in Excel 200 Fatih Can1968 Excel Discussion (Misc queries) 1 March 23rd 07 03:29 PM
Defining a name that represent identical ranges in every sheet Bernard Excel Discussion (Misc queries) 1 August 31st 06 02:18 PM
Defining identical names that represent different ranges of cells Bernard Excel Discussion (Misc queries) 2 August 31st 06 07:54 AM
Defining Ranges Steve Excel Worksheet Functions 5 May 28th 05 07:41 AM
Defining Ranges Greg Ghavalas Excel Programming 2 July 9th 03 10:10 PM


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