Transfer data from userform to spread sheet in excel

mmix803

New Member
Joined
Sep 21, 2024
Messages
16
Office Version
  1. 2021
Platform
  1. Windows
I am new to VBA and userforms. I cannot get my userform to transfer to my worksheet. This is what I have. I did little steps to see if it would go. It did not. Please help.

Private Sub submitcmd_Click()

Dim invoicedate As Date
Dim invoicenumber As Long

Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Invoice")

Dim nextRow As String
nextRow = ws.Range("A" & Rows.Count).End(xlUp).Row + 1

ws.Range("A" & nextRow) = invoicedatetxt.Value
ws.Range("B" & nextRow) = invoicenumbertxt.Value


End Sub
 
I did not understand you already had a means to open your user form. You can delete the following from the code and instructions that I
previously posted.

In this version I inserted a CommandButton on the userform (UserForm1) and the button's name is CommandButton1.

In a regular module paste the following :

Code:
Option Explicit

Sub shwFrm()
UserForm1.Show
End Sub

On the worksheet "Invoice" paste a CommandButton and attach it to this macro (shwFrm).
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Sorry it did not work and I double checked all. I even tried a command button of the spread sheet it did not work.
 
Upvote 0
Can you post your workbook (no confidential information please) to a cloud website so we can download it and see what is going on ?

Post the link to the workbook here.
 
Upvote 0
So you should attach file using dropbox or onedrive web to see your problem .
 
Upvote 0
Solution
Sorry for everything. I work in Access and love it. To me it is easier. I am only doing this in excel for my son. Access is not available on a mac computer. I have built a very nice data base and he can not use it . I use it and that because I do his books.
 
Upvote 0
I made a totally different sheet and it worked. Thank you for all your help and putting up with me. many thanks again.
 
Upvote 0
Good news. :)
Just change mark solved to Post #7 that I gave you the code,if it's work for you.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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