VBA Code Examples

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
Christine said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top