VBA to copy data from textbox to another worksheet

adityatandel

Board Regular
Joined
Aug 10, 2007
Messages
71
I have a VB code for a button so that on clicking it, a blank text box appears. Once the user fills in data in the text box, I would like to create a command button like a "Submit" button that on clicking will send data from that text box to another worksheet at the bottom most empty row, first column. Could anyone help me with this?
 
This should get you on the right track. You need to have a file in the same directory named “other_workbook.xls” or change the code to the name of the workbook to where you want to add the contents of the textbox to the last empty row in column A

Here is a link http://ptliving.net/d3/

Click on the link “2 attachments” and download “save to another workbook.xls”

Good luck!

winger
 
Upvote 0
Got distracted and forgot to include the code in my reply.

here ya go!

Code:
Option Explicit

Private Sub cmdOK_Click()

Workbooks.Open ("other_workbook.xls")

ActiveWorkbook.Sheets("Sheet1").Activate
Range("A1").Select


    Do
        If IsEmpty(ActiveCell) = False Then
        ActiveCell.Offset(1, 0).Select
        End If
        Loop Until IsEmpty(ActiveCell) = True
    
    ActiveCell.Value = TextBox1.Value

End Sub

winger
 
Upvote 0

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