View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
gregork gregork is offline
external usenet poster
 
Posts: 102
Default Simple Code Required

Hi Tolgag,


Thanks for the reply. I'm sorry to say I can't get the code to work.
1. With the combo box code I get compile error messages when I try to put
numbers in place of the i.What exactly am I supposed to input where you have
the i.... e.g Dim i as integer 'and' For i = 3 to 200.Is there a sheet
reference I am supposed to put in there somewhere?

2. I can't get a " Command1_OnClick()" event from the drop down lists at the
top of the code page. The nearest I can get is " Private Sub
CommandButton1_Click()".

I must apologise for my VBA dyslexia and thank you for your help.

regards
gregork


"tolgag " wrote in message
...
Hi gregork,

1. To fill the combo box with a range, put the following code to
Private Sub UserForm_Initialize() event of the form.Should be look like
this :

Dim i as integer
For i = 3 to 200
Me.ComboBox1.AddItem Cells(i,1) 'i = Rownr 1 is the columnnr
next

2. To insert the data into the sheet, put this code to Private
Command1_OnClick() event of the Command1 Button :
If me.ComboBox1.Value<"" And Not IsNull(me.ComboBox1) And
Me.TextBox1.Value<"" And Not Isnull(Me.TextBox1) then
Cells(3,3) = Me.ComboBox.Value
Cells(3,18) = Me.TextBox1.Value
Else
Msgbox "Please complete form"
End if


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