Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Populating a list box with specific ranges

Hi, i have a program which scans for data and then collects a list in two
columns. One column denoting a name and the adjescent column denoting the
number of occurances. The length of the list can vary quite dramatically.
My question is how to add this range into a list box at runtime. Can anyone
help? Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Populating a list box with specific ranges

Hi Graham,
This is an example written by the macro recorder.
Range("E1").Select '<--ADJUST!
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$A$13:$A$18"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub

When you defined your range, replace "=$A$13:$A$18" by the string describing
your range!

Regards,
Stefi


€˛Graham Whitehead€¯ ezt Ć*rta:

Hi, i have a program which scans for data and then collects a list in two
columns. One column denoting a name and the adjescent column denoting the
number of occurances. The length of the list can vary quite dramatically.
My question is how to add this range into a list box at runtime. Can anyone
help? Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Populating a list box with specific ranges

assume the upper left corner of the list/range will be in Cell B9 on sheet
Data and the range will be surrounded by at least one blank column/row on
each side. The list is already built when the useform is shown. the listbox
is on a userform:

Private Sub Userform_Initialize()
with worksheets("Data")
set rng = .range("B9").CurrentRegion
End with
listbox1.RowSource = rng.Address(1,1,xlA1,True)
Listbox1.Columncount = 2
end Sub

--
Regards,
Tom Ogilvy

"Graham Whitehead" wrote:

Hi, i have a program which scans for data and then collects a list in two
columns. One column denoting a name and the adjescent column denoting the
number of occurances. The length of the list can vary quite dramatically.
My question is how to add this range into a list box at runtime. Can anyone
help? 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
Populating a cell based on a specific date/combo cmatera Excel Worksheet Functions 2 August 20th 08 09:18 PM
.AddItem list and populating combobox with created list pallaver Excel Discussion (Misc queries) 8 June 27th 08 12:36 PM
Populating Specific Lists Based on Criteria Kate Excel Programming 2 September 15th 05 09:55 PM
populating list Wazooli Excel Programming 4 March 7th 05 10:50 PM
Populating dropdown list 2 with data depending upon what was selected in list 1 karambos Excel Programming 2 November 9th 04 05:32 PM


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