VBA UserForm

meeking86

New Member
Joined
Mar 11, 2020
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hi

I have build a userform to enter data onto a specific Sheet, however it will not run successfully using this code, can someone assist with what i am missing please, the Bold part being the bit its complaining about.

Private Sub Save_Click()

TargetSheet = ComboBox1.Value
If TargetSheet = "" Then
Exit Sub
End If

Worksheets("Quote Email").Activate
lastrow = ActiveSheet.Cells(Rows.Count, 1).End(x1Up).Row

ActiveSheet.Cells(lastrow + 1, 1).Value = txtsow.Value
ActiveSheet.Cells(lastrow + 1, 2).Value = txt1stday.Value
ActiveSheet.Cells(lastrow + 1, 3).Value = txtlastday.Value
ActiveSheet.Cells(lastrow + 1, 4).Value = txtno.Value
ActiveSheet.Cells(lastrow + 1, 5).Value = txtscono.Value
ActiveSheet.Cells(lastrow + 1, 6).Value = txtcoscono.Value
ActiveSheet.Cells(lastrow + 1, 7).Value = txtpermremoval.Value
ActiveSheet.Cells(lastrow + 1, 8).Value = txttempremoval.Value
ActiveSheet.Cells(lastrow + 1, 9).Value = txtrelocation.Value
ActiveSheet.Cells(lastrow + 1, 10).Value = txtrenumbering.Value
ActiveSheet.Cells(lastrow + 1, 11).Value = txtrehanding.Value
ActiveSheet.Cells(lastrow + 1, 12).Value = txtstandalone.Value

MsgBox ("Data added successfully")

txtsow.Value = ""
txt1stday.Value = ""
txtlastday.Value = ""
txtno.Value = ""
txtscono.Value = ""
txtpermremoval.Value = ""
txttempremoval.Value = ""
txtrelocation.Value = ""
txtrehanding.Value = ""
txtstandalone.Value = ""

Worksheets("Home").Activate
Worksheets("Home").Cells(1, 1).Select
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi & welcome to MrExcel.
It should be xlUp (lower case L) not x1Up (numeral one)
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,509
Messages
6,125,216
Members
449,215
Latest member
texmansru47

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