transfer data form userform to specific sheet

yoon

New Member
Joined
Jul 25, 2023
Messages
24
Office Version
  1. 365
Platform
  1. Windows
Hye and good morning to all, I have favor to ask which is I need to create userform to insert data about daily report workers. And I need to transfer the data to the specific sheet because I have multiples sheets that relate with specific workers. can yo all help me to build my userform with the coding also as I not have enough knowledge about vba excel🥺
 

Attachments

  • Screenshot 2023-07-28 083617.png
    Screenshot 2023-07-28 083617.png
    14.7 KB · Views: 9

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
General code to do this in your UserForm (probably a Button_Click event) is:

Worksheets("sheetname string").Range(range address) = TextBox1, ComboBox1, .... (control name that contains your data).

eg
VBA Code:
Worksheets("Sheet1").Range("A1") = TextBox1
 
Upvote 0
General code to do this in your UserForm (probably a Button_Click event) is:

Worksheets("sheetname string").Range(range address) = TextBox1, ComboBox1, .... (control name that contains your data).

eg
VBA Code:
Worksheets("Sheet1").Range("A1") = TextBox1
I did not fully understand. can you put the detail coding for me. I already build my userform and the last combobox is where I put all sheets that I will put the data. So, can you help me to build the specific coding for the combobox that contain all the sheets( just supposedly I have 4 sheets)
 

Attachments

  • Screenshot 2023-07-28 090403.png
    Screenshot 2023-07-28 090403.png
    13.8 KB · Views: 10
Upvote 0
VBA Code:
'sample code for Submit Button
Private Sub btnSubmit_Click()
  Dim wks As Worksheet
  
  Set wks = Worksheets(cbxSheets.Text)

  wks.Range("A1") = TextBox1
  wks.Range("B1") = TextBox2
  wks.Range("C1") = TextBox3
  wks.Range("D1") = TextBox4
End Sub


'sample code to initialize ComboBox (named cbxSheets)
Private Sub UserForm_Initialize()
  Dim wks As Worksheet
  
  For Each wks In Worksheets
    cbxSheets.AddItem wks.Name
  Next
  cbxSheets = "Sheet1"
End Sub
 
Upvote 0
okay thank you. But I want to ask can you help me if I want to add another column which is the value of A11/A11/60*A11 and it automatic will count in the sheet without I put the formula in the column?
 
Upvote 0
okay thank you. But I want to ask can you help me if I want to add another column which is the value of A11/A11/60*A11 and it automatic will count in the sheet without I put the formula in the column?
I'm sorry wrong formula. The formula is =E/G/60*H
 
Upvote 0
Yes. Any new sheets that you add will be included in the ComboBox when the form loads.

You might have to move the code to the form Activate Sub
 
Upvote 0

Forum statistics

Threads
1,215,094
Messages
6,123,071
Members
449,092
Latest member
ipruravindra

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