Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default more forms questions...

I have the following code to initialize a form that gets all the named
ranges in a workbook.

Private Sub UserForm_Initialize()
SourceTextBox.SetFocus
For Each nName In Names
Me.LeftBox.AddItem (nName.Name)
Next nName
End Sub

This works great but what I want to do now is initialize the form
putting the cursor in the SourceTextBox then taking as input from the
textbox the name of the sheet from where I want to get the named ranges
only from that sheet something like this...

Private Sub UserForm_Initialize()
SourceTextBox.SetFocus
End Sub

I get a Form that is empty and the cursor in the correct place.
I enter the name of the sheet I am interested in -- "data"
( goto the sheet read the named ranges of that sheet then insert them
in the correct list box then wait for the rest of the button acctions
(this code is already done)) something like this:

Private sub SourceTextBox_AfterUpdate()'entered "data" then enter

For Each nName In What do I put here ????
Me.LeftBox.AddItem (nName.What do I put here ???)
Next nName
end sub


Thanks

Chris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default more forms questions...

Hi Chris

Try:

Private Sub SourceTextBox_AfterUpdate()
Dim nName As Name
For Each nName In ThisWorkbook.Names
If nName.RefersToRange.Parent.Name = Me.SourceTextBox.Text Then
Me.LeftBox.AddItem nName.Name
End If
Next nName
End Sub

Hope this helps
Rowan

Chris Salcedo wrote:
I have the following code to initialize a form that gets all the named
ranges in a workbook.

Private Sub UserForm_Initialize()
SourceTextBox.SetFocus
For Each nName In Names
Me.LeftBox.AddItem (nName.Name)
Next nName
End Sub

This works great but what I want to do now is initialize the form
putting the cursor in the SourceTextBox then taking as input from the
textbox the name of the sheet from where I want to get the named ranges
only from that sheet something like this...

Private Sub UserForm_Initialize()
SourceTextBox.SetFocus
End Sub

I get a Form that is empty and the cursor in the correct place.
I enter the name of the sheet I am interested in -- "data"
( goto the sheet read the named ranges of that sheet then insert them
in the correct list box then wait for the rest of the button acctions
(this code is already done)) something like this:

Private sub SourceTextBox_AfterUpdate()'entered "data" then enter

For Each nName In What do I put here ????
Me.LeftBox.AddItem (nName.What do I put here ???)
Next nName
end sub


Thanks

Chris

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
Answers to questions posing more questions in a workbook sbelle1 Excel Worksheet Functions 2 August 8th 09 01:02 AM
View Questions and Answer to questions I created Roibn Taylor Excel Discussion (Misc queries) 4 July 24th 08 12:05 AM
Questions about Forms & Controls hmm Excel Discussion (Misc queries) 3 December 20th 06 01:06 PM
RefEdits and normal forms / forms in a DLL David Welch Excel Programming 0 December 1st 04 03:49 PM
Calling Forms from Forms - Exit problems Stuart[_5_] Excel Programming 3 May 25th 04 06:50 AM


All times are GMT +1. The time now is 01:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"