abdelfattah
Well-known Member
- Joined
- May 3, 2019
- Messages
- 1,494
- Office Version
- 2019
- 2010
- Platform
- Windows
hi guys
i have userform contains 35 textbox and 18 combobox i would transfer data to sheet i try make the code but it gives me error this line
[TABLE="width: 574"]
<tbody>[TR]
[TD="class: xl65, width: 574, colspan: 7"][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 574"]
<tbody>[TR]
[TD="class: xl65, width: 574, colspan: 7"].Cells(Lastrow, i).Value = Me.Controls("TextBox" & "combobox" & i)
the error message
could not find the specified object[/TD]
[/TR]
</tbody>[/TABLE]
this is my code
i have userform contains 35 textbox and 18 combobox i would transfer data to sheet i try make the code but it gives me error this line
[TABLE="width: 574"]
<tbody>[TR]
[TD="class: xl65, width: 574, colspan: 7"][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 574"]
<tbody>[TR]
[TD="class: xl65, width: 574, colspan: 7"].Cells(Lastrow, i).Value = Me.Controls("TextBox" & "combobox" & i)
the error message
could not find the specified object[/TD]
[/TR]
</tbody>[/TABLE]
this is my code
HTML:
Private Sub CommandButton1_Click()
Dim My_sh As Worksheet
Set My_sh = Worksheets("sheet1")
Dim Lastrow As Integer
Dim i% Application.ScreenUpdating = False
With My_sh Lastrow = .Cells(Rows.Count, 1).End(3).Row + 1
.Range(.Cells(Lastrow - 1, 1), .Cells(Lastrow - 1, 7)).Copy
.Cells(Lastrow, 1).PasteSpecial Paste:=xlPasteFormats
For i = 1 To 7
.Cells(Lastrow, i).Value = Me.Controls("TextBox" & "combobox" & i)
Me.Controls("TextBox" & "combobox" & i) = ""
Next
End With
Application.ScreenUpdating = True
Application.CutCopyMode = False
MsgBox "ok"
end sub
Last edited: