Move TextBox details to Cells in a different Worksheet

Denny57

Board Regular
Joined
Nov 23, 2015
Messages
185
Office Version
  1. 365
Platform
  1. Windows
This ought t be quite straightforward but I must be looking for the wrong information on the Internet.

I will be using a number of User Forms to display information and need to be able to user a separate User Form to upload and update details through a single worksheet.

Recalling informtion is not a problem, however, I need the correct syntax to upload information to a specific worksheet whilst having command buttons for all the user forms on a single separate worksheet.

I am sure that I just need to "activate" the target ws

Sample Code

VBA Code:
Private Sub cmdAddRecord_Click()
'Used to add new records to the database
Dim lastrow As Long
Dim TextA As String
TextA = TextBox3

If Application.WorksheetFunction.CountIf(Sheets("Worksheet2").Range("C5:C70"), TextA) > 0 Then

MsgBox "Texta already exists", 0, "Duplication Check"

Call UserForm_Initialize
txtTextBox2.SetFocus

Exit Sub

End If

lastrow = Sheets("Worksheet2").Range("B" & Rows.Count).End(xlUp).Row
'Cells(lastrow + 1, "A").Value = TextBox1
Cells(lastrow + 1, "B").Value = TextBox2
Cells(lastrow + 1, "C").Value = TextBox3
Cells(lastrow + 1, "D").Value = TextBox4

MsgBox TextBox3 & " has been added to the database", 0, "Record Added"

Call UserForm_Initialize
txtTextBox2.SetFocus

End Sub

Note I have yet to determine if
'Cells(lastrow + 1, "A").Value = TextBox1
needs to be included.

Hoping someone can assist
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Good to hear you got the solution.

If you would like to post the solution then it is perfectly fine to mark your post as the solution to help future readers. Otherwise, please do not mark a post that doesn't contain a solution.
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,446
Members
449,083
Latest member
Ava19

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