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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,218,516
Messages
6,142,921
Members
450,455
Latest member
Handienak

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
Back
Top