Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default comboBox vs Listbox

I'm stumped!!

I am trying to populate a Combobox from a range of data. Using the code
below, I can fill a listbox. However, If I add ComboBox1 to the form and
change the code below from "Me.ListBox1.AddItem cell.Value" to
"Me.ComboBox1.AddItem cell.Value", I get an error: Runtime error 70
Permission denied. Can someone help?

Private Sub UserForm_Initialize()
Dim cell As Range
Dim rng As Range

With ThisWorkbook.Sheets("shOrder")
Set rng = .Range("a4", .Range("a4").End(xlDown))
End With

For Each cell In rng.Cells
Me.ListBox1.AddItem cell.Value
Next cell
End sub

--
Steve


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default comboBox vs Listbox

That sounds as though you have set the RowSource property in the Combobox,
which means you cannoty add to the combo.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Steve" <No Spam wrote in message ...
I'm stumped!!

I am trying to populate a Combobox from a range of data. Using the code
below, I can fill a listbox. However, If I add ComboBox1 to the form and
change the code below from "Me.ListBox1.AddItem cell.Value" to
"Me.ComboBox1.AddItem cell.Value", I get an error: Runtime error 70
Permission denied. Can someone help?

Private Sub UserForm_Initialize()
Dim cell As Range
Dim rng As Range

With ThisWorkbook.Sheets("shOrder")
Set rng = .Range("a4", .Range("a4").End(xlDown))
End With

For Each cell In rng.Cells
Me.ListBox1.AddItem cell.Value
Next cell
End sub

--
Steve




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default comboBox vs Listbox

Bob

That sounds right and is right!

Should have spotted that myself. Didn't even look at properties. Just swore
a lot. Strange that the latter didn't fix it <bg.

--
Steve


"Bob Phillips" wrote in message
...
That sounds as though you have set the RowSource property in the Combobox,
which means you cannoty add to the combo.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Steve" <No Spam wrote in message ...
I'm stumped!!

I am trying to populate a Combobox from a range of data. Using the code
below, I can fill a listbox. However, If I add ComboBox1 to the form and
change the code below from "Me.ListBox1.AddItem cell.Value" to
"Me.ComboBox1.AddItem cell.Value", I get an error: Runtime error 70
Permission denied. Can someone help?

Private Sub UserForm_Initialize()
Dim cell As Range
Dim rng As Range

With ThisWorkbook.Sheets("shOrder")
Set rng = .Range("a4", .Range("a4").End(xlDown))
End With

For Each cell In rng.Cells
Me.ListBox1.AddItem cell.Value
Next cell
End sub

--
Steve






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
Combobox/Listbox Difference WLMPilot Excel Discussion (Misc queries) 1 November 21st 06 01:46 PM
Combobox v Listbox MBlake New Users to Excel 5 April 24th 05 11:58 AM
Combobox/listbox FSt1 Excel Discussion (Misc queries) 3 January 4th 05 06:55 PM
Combobox or Listbox Kathy[_7_] Excel Programming 2 December 4th 03 03:48 PM
listbox-combobox category GUS Excel Programming 1 September 12th 03 04:52 PM


All times are GMT +1. The time now is 07:27 PM.

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"