Adjusting code transfer data from combo box & textbox into userform to sheet
Closed
abdelfatah_0230
Posts
73
Registration date
Thursday 18 July 2019
Status
Member
Last seen
23 July 2022
-
3 Nov 2019 à 04:56
Facebook - 21 Nov 2019 à 16:03
Facebook - 21 Nov 2019 à 16:03
Related:
- Adjusting code transfer data from combo box & textbox into userform to sheet
- How to copy data from one excel sheet to another - Guide
- Excel move data from one sheet to another - Guide
- Free fire transfer - Guide
- How to copy data to multiple worksheets in Excel - Guide
- Vba userform - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
5 Nov 2019 à 11:41
5 Nov 2019 à 11:41
Hi Abdel,
You are getting an error because you have TextBox# and ComboBox#, but not a TextBoxComboBox#.
You could change:
.Cells(Lastrow, i).Value = Me.Controls("TextBox" & "combobox" & i)
Me.Controls("TextBox" & "combobox" & i) = ""
into:
.Cells(Lastrow, i).Value = Me.Controls("TextBox" & i) & " " & Me.Controls("ComboBox" & i)
Me.Controls("TextBox" & i) = vbnullstring
Me.Controls("ComboBox" & i) = vbnullstring
Best regards,
Trowa
You are getting an error because you have TextBox# and ComboBox#, but not a TextBoxComboBox#.
You could change:
.Cells(Lastrow, i).Value = Me.Controls("TextBox" & "combobox" & i)
Me.Controls("TextBox" & "combobox" & i) = ""
into:
.Cells(Lastrow, i).Value = Me.Controls("TextBox" & i) & " " & Me.Controls("ComboBox" & i)
Me.Controls("TextBox" & i) = vbnullstring
Me.Controls("ComboBox" & i) = vbnullstring
Best regards,
Trowa
5 Nov 2019 à 14:43
i attach my file
https://ufile.io/u2xzo9cy
11 Nov 2019 à 11:52
When the code errors out, place your cursor over the yellow line above the "i". It should tell you that the current value for i = 7. That means that 1 to 6 went ok. So I checked TextBox7 and ComboBox7. Which showed the reason for the error: you don't have a ComboBox7.
Best regards,
Trowa
11 Nov 2019 à 13:24
12 Nov 2019 à 11:49
Row 40 is the first empty row of column A from the bottom up, which is what this part of the code does:
Cells(Rows.Count, 1).End(3).Row + 1
And since that cell is merged, only the value in column A is shown.
Best regards,
Trowa
12 Nov 2019 à 13:47
by the way the cells rows from 23:24 not emerged cells