abdo meghari
Active Member
- Joined
- Aug 3, 2021
- Messages
- 465
- Office Version
- 2019
hi
i try making macro to copy data from userform to sheet with multiple textbox and combobox . it take from me more time if i have many combobox and textbox so i truly apprecitae if there is way to make the code is short
can anybody help ,please? if this is not enough I will attach picture for userform
thanks in advance
i try making macro to copy data from userform to sheet with multiple textbox and combobox . it take from me more time if i have many combobox and textbox so i truly apprecitae if there is way to make the code is short
VBA Code:
Private Sub CommandButton1_Click()
Dim lr As Integer
Dim ws As Worksheet
Set ws = Sheets("invoice")
Range("e5").MergeArea = Me.TextBox1.Value
Range("e8").MergeArea = Me.TextBox2.Value
Range("a16").Value = Me.TextBox3
Range("a17").Value = Me.TextBox4
Range("a18").Value = Me.TextBox5
Range("a19").Value = Me.TextBox6
Range("E16").Value = Me.TextBox7
Range("E17").Value = Me.TextBox8
Range("E18").Value = Me.TextBox9
Range("E19").Value = Me.TextBox10
Range("F16").Value = Me.TextBox11
Range("F17").Value = Me.TextBox12
Range("F18").Value = Me.TextBox13
Range("F19").Value = Me.TextBox14
Range("G16").Value = Me.TextBox15
Range("G17").Value = Me.TextBox16
Range("G18").Value = Me.TextBox17
Range("G19").Value = Me.TextBox18
Range("B16").Value = Me.ComboBox1
Range("B17").Value = Me.ComboBox2
Range("B18").Value = Me.ComboBox3
Range("B19").Value = Me.ComboBox4
Range("C16").Value = Me.ComboBox5
Range("C17").Value = Me.ComboBox6
Range("C18").Value = Me.ComboBox7
Range("C19").Value = Me.ComboBox8
Range("D16").Value = Me.ComboBox9
Range("D17").Value = Me.ComboBox10
Range("D18").Value = Me.ComboBox11
Range("D19").Value = Me.ComboBox12
TextBox15.Value = Me.TextBox7.Value * Me.TextBox11.Value
TextBox16.Value = Me.TextBox8.Value * Me.TextBox12.Value
TextBox17.Value = Me.TextBox9.Value * Me.TextBox13.Value
TextBox18.Value = Me.TextBox10.Value * Me.TextBox14.Value
End Sub
thanks in advance