Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to get a range of values into a combo placed on USERFORM?

Hi All

Please let me know some method for filling range of data to combobox on a userform from spreadsheet
The range data will be present on the spreadsheet
I filled the combo by entering individual cell values in the VBA code.Instead of doing like thi
is there any method of selecting a range of values from a sheet and put the same data into the combo in one go

Please put some light on this

Thank
Harinath
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default How to get a range of values into a combo placed on USERFORM?

Hi Harinath

Here's one way to do it:

For data in a column:

Private Sub UserForm_Initialize()
Dim DataRange As Range
Dim DataRangeValue As Variant

Set DataRange = Sheets("Sheet1").Range("A1:A7")
DataRangeValue = DataRange.Value

Me.ComboBox1.List = DataRangeValue
End Sub


For data in a row

Private Sub UserForm_Initialize()
Dim DataRange As Range
Dim DataRangeValue As Variant

Set DataRange = Sheets("Sheet1").Range("A1:G1")
DataRangeValue = DataRange.Value

Me.ComboBox1.Column = DataRangeValue
End Sub


--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"Harinath" skrev i en meddelelse
...
Hi All,

Please let me know some method for filling range of data to combobox on a

userform from spreadsheet.
The range data will be present on the spreadsheet.
I filled the combo by entering individual cell values in the VBA

code.Instead of doing like this
is there any method of selecting a range of values from a sheet and put

the same data into the combo in one go.

Please put some light on this.

Thanks
Harinath



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to get a range of values into a combo placed on USERFORM?

Controls start numbering at zero so :-

'-------------------------------------------
'- initialise form
Private Sub UserForm_Initialize()
Set DataSheet = ThisWorkbook.Worksheets("data")
Set MyList = DataSheet.Range("FileList")
Rw = 1
While MyList.Cells(Rw, 1).Value < ""
ComboBox1.AddItem
ComboBox1.List(Rw - 1) = MyList.Cells(Rw, 1).Value
Rw = Rw + 1
Wend
End Sub
'---------------------------------

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default How to get a range of values into a combo placed on USERFORM?

Combobox1.List = Range("A1:A100").Value

"Harinath" wrote in message
...
Hi All,

Please let me know some method for filling range of data to combobox on a

userform from spreadsheet.
The range data will be present on the spreadsheet.
I filled the combo by entering individual cell values in the VBA

code.Instead of doing like this
is there any method of selecting a range of values from a sheet and put

the same data into the combo in one go.

Please put some light on this.

Thanks
Harinath



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
Userform Initialize & combo box values michaelberrier Excel Discussion (Misc queries) 3 June 27th 06 04:35 PM
Userform combo box triggering macros michaelberrier Excel Discussion (Misc queries) 6 June 10th 06 01:25 PM
UserForm and combo box to another sheet Nigel Excel Discussion (Misc queries) 0 April 29th 05 09:41 AM
data from combo box in userform to spreasheet???? URGENT!! KrisB_bacon Excel Programming 3 January 1st 04 09:58 AM
Combo Box in userform Andy Excel Programming 0 November 18th 03 07:31 PM


All times are GMT +1. The time now is 01:06 PM.

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"