create userform

dharsana

Board Regular
Joined
Sep 7, 2002
Messages
58
hi,
I am very new to userform creation and I want to create a userform containing 10 textboxes and after enter the texts ,if I press update the data should be updated to the first available empty row.I have created the user form and I do not know how to write a code for the above purpose.Can any one help?.I also want to know how to maximise userform to full screen?

dharsana
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Paul B

Well-known Member
Joined
Feb 15, 2002
Messages
575
Ok, I am sure someone else could do this better but this should get you started, modify code to include your other text boxes
Code:
Private Sub CommandButton1_Click()
'puts the values from user form text box 1 in sheet3 starting in A2
'puts the values from user form text box 2 in sheet3 starting in B2
' keeps moving down the sheet to the next row
CurrentsheetName = ActiveSheet.Name
Application.ScreenUpdating = False
Sheets("Sheet3").Select
Range("A65536").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = UserForm1.TextBox1.Value
ActiveCell.Offset(0, 1).Value = UserForm1.TextBox2.Value
UserForm1.TextBox1.Value = ""
UserForm1.TextBox2.Value = ""
Unload UserForm1
Worksheets(CurrentsheetName).Select
Application.ScreenUpdating = True
End Sub


_________________<FONT SIZE=4 COLOR="red">Paul B</FONT>
Remember To Always Back Up Your Data Before Trying Something New
Using Excel '97
This message was edited by paul b on 2002-10-06 17:11
 

Fryer Tuck

Board Regular
Joined
Mar 20, 2002
Messages
64
I will assume that you are in the sheet you want to be. Also, that you have your textboxes consecutively numbered.

Dim AdrStr as string 'last cell address string
Dim Cntr as Integer
AdrStr = range("A1").end(xlDown).Address
For Cntr = 1 to 10
Range(AdrStr).Offset(Cntr) = Controls("TextBox" & Cntr)
Next

As far as maximizing the userform, look at the properties for the form.

F.T.
 

Forum statistics

Threads
1,144,213
Messages
5,723,055
Members
422,476
Latest member
beck85

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top