PC Review


Reply
Thread Tools Rate Thread

ARRG! Names not showing up, can't use in validation or ListBox??!

 
 
Ed from AZ
Guest
Posts: n/a
 
      16th Dec 2008
In XL 2007, I'm naming ranges using
nm = wks.Name
a = a - 1
rg = wks2.Range(Cells(21, b), Cells(a, b))
wks2.Names.Add _
Name:=nm, _
RefersTo:=rg, _
Visible:=True

I can see them in the Name Manager, but I can not see them in the
Names box (upper left), nor can I reference them as a Data Validation
source or a ListBox source.

What I really want to do is use two ListBoxes, with LB2 taking its
reference from the selection of LB1. I found this from Debra
Dalgleish:

Create a change event for ListBox1, with code similar to the
following:

Private Sub ListBox1_Change()
ListBox2.ListFillRange = ListBox1.Value
End Sub

but I can't get the ListBox I created on the worksheet to accept the
named range as a source!!

Can someone help me make sense of this?

Ed
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      16th Dec 2008
You are defining a worksheet level name, that will only be visible in the
names box on its own sheet. You can use it in other sheets by prefixing
like this

='Sheet name'!theName

the apostrophes may be required if there is punctuation or some other
characters like a space in the sheet name.

You should be able to use in a listbox on other sheets by prefixing as above

You can't refer to other sheets in a DV list but you can work around like
this -
=INDIRECT("sheet1!theName")

Regards,
Peter T


"Ed from AZ" <(E-Mail Removed)> wrote in message
news:f805f563-aaae-41d2-b25b-(E-Mail Removed)...
> In XL 2007, I'm naming ranges using
> nm = wks.Name
> a = a - 1
> rg = wks2.Range(Cells(21, b), Cells(a, b))
> wks2.Names.Add _
> Name:=nm, _
> RefersTo:=rg, _
> Visible:=True
>
> I can see them in the Name Manager, but I can not see them in the
> Names box (upper left), nor can I reference them as a Data Validation
> source or a ListBox source.
>
> What I really want to do is use two ListBoxes, with LB2 taking its
> reference from the selection of LB1. I found this from Debra
> Dalgleish:
>
> Create a change event for ListBox1, with code similar to the
> following:
>
> Private Sub ListBox1_Change()
> ListBox2.ListFillRange = ListBox1.Value
> End Sub
>
> but I can't get the ListBox I created on the worksheet to accept the
> named range as a source!!
>
> Can someone help me make sense of this?
>
> Ed



 
Reply With Quote
 
Ed from AZ
Guest
Posts: n/a
 
      16th Dec 2008
Hi, Peter. Thanks for helping. I need to get this solved today!!

The worksheet is named "DataEntry". At this time, I am creating three
named ranges in DataEntry using the code previously posted. I am
trying to use these names for a data validation drop-down list in
cells in DataEntry. (I'm no longer worrying about a ListBox.)

The names box on DataEntry does not show these names. Validation
using these names evaluates to an error. If I manually name the
ranges to the scope of the worksheet, they show up and I can use them.

What am I missing from the code to create a named range I can use?

Ed


On Dec 16, 9:10*am, "Peter T" <peter_t@discussions> wrote:
> You are defining a worksheet level name, that will only be visible in the
> names box on its own sheet. *You can use it in other sheets by prefixing
> like this
>
> ='Sheet name'!theName
>
> the apostrophes may be required if there is punctuation or some other
> characters like a space in the sheet name.
>
> You should be able to use in a listbox on other sheets by prefixing as above
>
> You can't refer to other sheets in a DV list but you can work around like
> this -
> =INDIRECT("sheet1!theName")
>
> Regards,
> Peter T
>
> "Ed from AZ" <prof_ofw...@yahoo.com> wrote in messagenews:f805f563-aaae-41d2-b25b-(E-Mail Removed)...
>
>
>
> > In XL 2007, I'm naming ranges using
> > * * *nm = wks.Name
> > * * *a = a - 1
> > * * *rg = wks2.Range(Cells(21, b), Cells(a, b))
> > * * *wks2.Names.Add _
> > * * * *Name:=nm, _
> > * * * *RefersTo:=rg, _
> > * * * *Visible:=True

>
> > I can see them in the Name Manager, but I can not see them in the
> > Names box (upper left), nor can I reference them as a Data Validation
> > source or a ListBox source.

>
> > What I really want to do is use two ListBoxes, with LB2 taking its
> > reference from the selection of LB1. *I found this from Debra
> > Dalgleish:

>
> > * Create a change event for ListBox1, with code similar to the
> > following:

>
> > * Private Sub ListBox1_Change()
> > * * *ListBox2.ListFillRange = ListBox1.Value
> > * End Sub

>
> > but I can't get the ListBox I created on the worksheet to accept the
> > named range as a source!!

>
> > Can someone help me make sense of this?

>
> > Ed- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      16th Dec 2008
You haven't posted all your actual code so it's difficult to say if there's
something wrong, I assume you've just typed some snippets.

Just looking at what you have posted would need to change

> > rg = wks2.Range(Cells(21, b), Cells(a, b))

to
Set rg = wks2.Range(Cells(21, b), Cells(a, b))

Other things, wks2 would need to correctly refer to a worksheet (having used
the Set statement) and a & b would need to be valid row/col numbers.

It's probably better not to name the name same as the sheet.

Regards,
Peter T


"Ed from AZ" <(E-Mail Removed)> wrote in message
news:f6011637-1fb7-427b-9f9a-(E-Mail Removed)...
Hi, Peter. Thanks for helping. I need to get this solved today!!

The worksheet is named "DataEntry". At this time, I am creating three
named ranges in DataEntry using the code previously posted. I am
trying to use these names for a data validation drop-down list in
cells in DataEntry. (I'm no longer worrying about a ListBox.)

The names box on DataEntry does not show these names. Validation
using these names evaluates to an error. If I manually name the
ranges to the scope of the worksheet, they show up and I can use them.

What am I missing from the code to create a named range I can use?

Ed


On Dec 16, 9:10 am, "Peter T" <peter_t@discussions> wrote:
> You are defining a worksheet level name, that will only be visible in the
> names box on its own sheet. You can use it in other sheets by prefixing
> like this
>
> ='Sheet name'!theName
>
> the apostrophes may be required if there is punctuation or some other
> characters like a space in the sheet name.
>
> You should be able to use in a listbox on other sheets by prefixing as
> above
>
> You can't refer to other sheets in a DV list but you can work around like
> this -
> =INDIRECT("sheet1!theName")
>
> Regards,
> Peter T
>
> "Ed from AZ" <prof_ofw...@yahoo.com> wrote in
> messagenews:f805f563-aaae-41d2-b25b-(E-Mail Removed)...
>
>
>
> > In XL 2007, I'm naming ranges using
> > nm = wks.Name
> > a = a - 1
> > rg = wks2.Range(Cells(21, b), Cells(a, b))
> > wks2.Names.Add _
> > Name:=nm, _
> > RefersTo:=rg, _
> > Visible:=True

>
> > I can see them in the Name Manager, but I can not see them in the
> > Names box (upper left), nor can I reference them as a Data Validation
> > source or a ListBox source.

>
> > What I really want to do is use two ListBoxes, with LB2 taking its
> > reference from the selection of LB1. I found this from Debra
> > Dalgleish:

>
> > Create a change event for ListBox1, with code similar to the
> > following:

>
> > Private Sub ListBox1_Change()
> > ListBox2.ListFillRange = ListBox1.Value
> > End Sub

>
> > but I can't get the ListBox I created on the worksheet to accept the
> > named range as a source!!

>
> > Can someone help me make sense of this?

>
> > Ed- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
Ed from AZ
Guest
Posts: n/a
 
      16th Dec 2008
Thanks for helping, Peter. I managed to get it working. Not sure
how, but it's doing what it's supposed to. I'll examine it later.

Ed

On Dec 16, 10:48*am, "Peter T" <peter_t@discussions> wrote:
> You haven't posted all your actual code so it's difficult to say if there's
> something wrong, I assume you've just typed some snippets.
>
> Just looking at what you have posted would need to change
>
> > > rg = wks2.Range(Cells(21, b), Cells(a, b))

>
> to
> Set rg = wks2.Range(Cells(21, b), Cells(a, b))
>
> Other things, wks2 would need to correctly refer to a worksheet (having used
> the Set statement) and a & b would need to be valid row/col numbers.
>
> It's probably better not to name the name same as the sheet.
>
> Regards,
> Peter T
>
> "Ed from AZ" <prof_ofw...@yahoo.com> wrote in messagenews:f6011637-1fb7-427b-9f9a-(E-Mail Removed)...
> Hi, Peter. *Thanks for helping. *I need to get this solved today!!
>
> The worksheet is named "DataEntry". *At this time, I am creating three
> named ranges in DataEntry using the code previously posted. *I am
> trying to use these names for a data validation drop-down list in
> cells in DataEntry. *(I'm no longer worrying about a ListBox.)
>
> The names box on DataEntry does not show these names. *Validation
> using these names evaluates to an error. *If I manually name the
> ranges to the scope of the worksheet, they show up and I can use them.
>
> What am I missing from the code to create a named range I can use?
>
> Ed
>
> On Dec 16, 9:10 am, "Peter T" <peter_t@discussions> wrote:
>
>
>
> > You are defining a worksheet level name, that will only be visible in the
> > names box on its own sheet. You can use it in other sheets by prefixing
> > like this

>
> > ='Sheet name'!theName

>
> > the apostrophes may be required if there is punctuation or some other
> > characters like a space in the sheet name.

>
> > You should be able to use in a listbox on other sheets by prefixing as
> > above

>
> > You can't refer to other sheets in a DV list but you can work around like
> > this -
> > =INDIRECT("sheet1!theName")

>
> > Regards,
> > Peter T

>
> > "Ed from AZ" <prof_ofw...@yahoo.com> wrote in
> > messagenews:f805f563-aaae-41d2-b25b-(E-Mail Removed)...

>
> > > In XL 2007, I'm naming ranges using
> > > nm = wks.Name
> > > a = a - 1
> > > rg = wks2.Range(Cells(21, b), Cells(a, b))
> > > wks2.Names.Add _
> > > Name:=nm, _
> > > RefersTo:=rg, _
> > > Visible:=True

>
> > > I can see them in the Name Manager, but I can not see them in the
> > > Names box (upper left), nor can I reference them as a Data Validation
> > > source or a ListBox source.

>
> > > What I really want to do is use two ListBoxes, with LB2 taking its
> > > reference from the selection of LB1. I found this from Debra
> > > Dalgleish:

>
> > > Create a change event for ListBox1, with code similar to the
> > > following:

>
> > > Private Sub ListBox1_Change()
> > > ListBox2.ListFillRange = ListBox1.Value
> > > End Sub

>
> > > but I can't get the ListBox I created on the worksheet to accept the
> > > named range as a source!!

>
> > > Can someone help me make sense of this?

>
> > > Ed- Hide quoted text -

>
> > - Show quoted text -- Hide quoted text -

>
> - Show quoted text -


 
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
Listbox Validation Steve Microsoft Excel Programming 4 19th Jul 2009 04:56 PM
Validation Summary not showing for client side validation cwhankey@gmail.com Microsoft ASP .NET 1 12th Dec 2008 02:32 AM
Default value for combobox on continuous subform ARRG! serviceman via AccessMonster.com Microsoft Access Form Coding 3 3rd Apr 2006 08:50 PM
Validation control bound to listbox but "*" not showing during err =?Utf-8?B?a2VuIGJ1cw==?= Microsoft ASP .NET 0 12th Oct 2004 12:45 AM
drag of vlookup function does not work any more - arrg =?Utf-8?B?VWxmZXJ0?= Microsoft Excel Worksheet Functions 2 1st May 2004 12:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:58 AM.