View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default VBA Code Examples

"Christine" skrev i melding
...
I'm new to VBA and attempting to write the code for a userform that will
input a new record into Excel via drop down lists. I'm looking to find a
simple example of userform code to learn off of but can't find any

online -
any recommendations as to where I should be looking?


For a start, it's usually as simple as finding the downmost row number and
write to the row below it like

Dim R as Long
'downmost A cell row number plus one:
R = Sheets(1).Cells(65000, 1).End(xlup).Row +1
'write:
Sheets(1).Cells(R, 1).Value = Val(Textbox1.Text)
Sheets(1).Cells(R, 2).Value = ListBox1.Text
Sheets(1).Cells(R, 3).Value = ComboBox3.Text
....

The rownumber R is the real key for all "records" operations, you may want
to extend the form to read and modify records after you get this working.

HTH. Best wishes Harald