ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Code Examples (https://www.excelbanter.com/excel-programming/361363-vba-code-examples.html)

Christine

VBA Code Examples
 
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?

Harald Staff

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



Mike Q.

VBA Code Examples
 
Here is a web site that is always a help to me.
http://www.contextures.com/xlUserForm02.html
--
Mike Q.


"Christine" wrote:

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?



All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com