PC Review


Reply
Thread Tools Rate Thread

change named range

 
 
geebee
Guest
Posts: n/a
 
      8th Aug 2008
hi,

i am trying to yield/get at this new range programmatically:
=lookup!$AB$14:OFFSET(lookup!$AB$14,lookup!$AC$100,0)

by using:
ActiveWorkbook.Names.Add Name:="MONTH_SOURCE2", RefersToR1C1:= _
"='lookup'!R1C28:OFFSET('lookup'!R1C28, 'lookup'!R" & NEWMO3 & "C29"

but i cant figure out what is wrong with my syntax.

thanks in advance,
geebee

 
Reply With Quote
 
 
 
 
eholz1
Guest
Posts: n/a
 
      8th Aug 2008
On Aug 8, 1:18 pm, geebee <geraldj...@hotmail.com(noSPAMs)> wrote:
> hi,
>
> i am trying to yield/get at this new range programmatically:
> =lookup!$AB$14:OFFSET(lookup!$AB$14,lookup!$AC$100,0)
>
> by using:
> ActiveWorkbook.Names.Add Name:="MONTH_SOURCE2", RefersToR1C1:= _
> "='lookup'!R1C28:OFFSET('lookup'!R1C28, 'lookup'!R" & NEWMO3 & "C29"
>
> but i cant figure out what is wrong with my syntax.
>
> thanks in advance,
> geebee


Guess number one: I think you might need parens around your lookup
functions??

= lookup(parameters,range) I never us R1C1 notation so you may be able
to omit parens using that syntax.

eholz1
 
Reply With Quote
 
Jim Thomlinson
Guest
Posts: n/a
 
      8th Aug 2008
it is kinda difficult to determine exactly what you want from your post so
here is generally one way to do named ranges

dim rng as range

with sheets("Lookup")
set rng = .range(.range("AB1"), .cells(rows.count, "AC").end(xlup))
end with

Thisworkbook.names.add Name:="MONTH_SOURCE2", RefersToRange:=rng

This creates a named range from AB1:AC?? where ?? is the last populated row
in AC.
--
HTH...

Jim Thomlinson


"geebee" wrote:

> hi,
>
> i am trying to yield/get at this new range programmatically:
> =lookup!$AB$14:OFFSET(lookup!$AB$14,lookup!$AC$100,0)
>
> by using:
> ActiveWorkbook.Names.Add Name:="MONTH_SOURCE2", RefersToR1C1:= _
> "='lookup'!R1C28:OFFSET('lookup'!R1C28, 'lookup'!R" & NEWMO3 & "C29"
>
> but i cant figure out what is wrong with my syntax.
>
> thanks in advance,
> geebee
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      8th Aug 2008
I don't see that last comma, zero and close paren: ,0)
in your code.

ActiveWorkbook.Names.Add Name:="MONTH_SOURCE2", RefersToR1C1:= _
"='lookup'!R1C28:OFFSET('lookup'!R1C28, 'lookup'!R" & NEWMO3 & "C29,0)"

geebee wrote:
>
> hi,
>
> i am trying to yield/get at this new range programmatically:
> =lookup!$AB$14:OFFSET(lookup!$AB$14,lookup!$AC$100,0)
>
> by using:
> ActiveWorkbook.Names.Add Name:="MONTH_SOURCE2", RefersToR1C1:= _
> "='lookup'!R1C28:OFFSET('lookup'!R1C28, 'lookup'!R" & NEWMO3 & "C29"
>
> but i cant figure out what is wrong with my syntax.
>
> thanks in advance,
> geebee


--

Dave Peterson
 
Reply With Quote
 
geebee
Guest
Posts: n/a
 
      14th Aug 2008
hi,

i want to be able to know how to change the named range while also adding
the header row in row 1. for example, if the new range is like rows 56 - 99,
this new range does not include the header row, so i cant use it as a graph
source. what do i need to do?

thanks in advance,
geebee


"Dave Peterson" wrote:

> I don't see that last comma, zero and close paren: ,0)
> in your code.
>
> ActiveWorkbook.Names.Add Name:="MONTH_SOURCE2", RefersToR1C1:= _
> "='lookup'!R1C28:OFFSET('lookup'!R1C28, 'lookup'!R" & NEWMO3 & "C29,0)"
>
> geebee wrote:
> >
> > hi,
> >
> > i am trying to yield/get at this new range programmatically:
> > =lookup!$AB$14:OFFSET(lookup!$AB$14,lookup!$AC$100,0)
> >
> > by using:
> > ActiveWorkbook.Names.Add Name:="MONTH_SOURCE2", RefersToR1C1:= _
> > "='lookup'!R1C28:OFFSET('lookup'!R1C28, 'lookup'!R" & NEWMO3 & "C29"
> >
> > but i cant figure out what is wrong with my syntax.
> >
> > thanks in advance,
> > geebee

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      14th Aug 2008
I would copy the header to a new worksheet, then copy the rows I want under that
header on the new sheet.

(If I understand correctly????)

geebee wrote:
>
> hi,
>
> i want to be able to know how to change the named range while also adding
> the header row in row 1. for example, if the new range is like rows 56 - 99,
> this new range does not include the header row, so i cant use it as a graph
> source. what do i need to do?
>
> thanks in advance,
> geebee
>
> "Dave Peterson" wrote:
>
> > I don't see that last comma, zero and close paren: ,0)
> > in your code.
> >
> > ActiveWorkbook.Names.Add Name:="MONTH_SOURCE2", RefersToR1C1:= _
> > "='lookup'!R1C28:OFFSET('lookup'!R1C28, 'lookup'!R" & NEWMO3 & "C29,0)"
> >
> > geebee wrote:
> > >
> > > hi,
> > >
> > > i am trying to yield/get at this new range programmatically:
> > > =lookup!$AB$14:OFFSET(lookup!$AB$14,lookup!$AC$100,0)
> > >
> > > by using:
> > > ActiveWorkbook.Names.Add Name:="MONTH_SOURCE2", RefersToR1C1:= _
> > > "='lookup'!R1C28:OFFSET('lookup'!R1C28, 'lookup'!R" & NEWMO3 & "C29"
> > >
> > > but i cant figure out what is wrong with my syntax.
> > >
> > > thanks in advance,
> > > geebee

> >
> > --
> >
> > Dave Peterson
> >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to change a named range Brian Microsoft Excel Programming 2 13th Apr 2010 02:55 PM
Change Event on a named range GregR Microsoft Excel Programming 2 12th Jul 2005 09:37 PM
How to unname or change a named range =?Utf-8?B?ZHJmcnll?= Microsoft Excel Misc 2 8th Nov 2004 01:05 AM
Change named range value =?Utf-8?B?Sm9lIEJvdWNoZXI=?= Microsoft Excel Programming 2 30th Sep 2004 01:41 AM
change named range within macro JulieM Microsoft Excel Programming 5 19th Mar 2004 08:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:48 PM.