You are here:digital world -> music -> Content
Hot Articles
Recommend Articles
New Articles
windows xp pro/Macro with UserForm
Author:   Add date: 05/05/2008   Publishing date: 05/05/2008   Hits: 0
windows xp pro/
Hiya!
This is what I exactly need to do:
Ive got an Excel Sheet:


I basically have to get the 'Add New' Button in it, to make a UserForm come up (I've already made it from VB Editor),
.

.



After it makes the Userform come, and after filling in the Date, Description etc..Fields, you should be able to click on 'Add Entry' (in the form), and Excel should create a new row right under the last item in the Excel Sheet with all of what you filled in.
Basically if you fill in:
Date: 18/12/07
Description: Tables
Then the Excel Sheet should create a new row under (in this case) Kitchen Dining Chairs with all of what you typed in the Form.

Thanks a lot!
------------

Hi and welcome to TSF.

You need to code the button click to actually add the form data to the worksheet. When using forms, I always name the controls - it makes them easier to identify. For example, I might name a textbox as txbName - you can then refer to that in your code.

To find the last row with data use
Code:
Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp)
To move down to the next empty row use
Code:
Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
So, to place a value from a form into the next empty cell in column A, would be something like
Code:
Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Value = UserForm1.txbName.Value
You'll need to amend the code to match your sheet name, userform name and control name. Then repeat for each control.

Hopefully that will give you a start - post back with any problems.
Prev:free music downloads for itunes Los Rabanes - Ella Se Mueve Cruel Next:windows xp password/help on new MOBO install only have a recovery disk

Comment:

Category: Home -> music