Here's the revised code
Code:Private Sub CommandButton1_Click() Dim lngCol As Long Dim ctl As Object For Each ctl In Me.Controls If ctl.Tag <> vbNullString Then If ctl.Value = vbNullString Then MsgBox ctl.Tag: ctl.SetFocus: Exit Sub End If Next With Sheets("LENTICULAR-MEMBRANES") lngCol = .Rows("2:2").Find(What:="SET " & ComboBox2.Text, LookAt:=xlWhole).Column With .Cells(.Rows.Count, lngCol).End(xlUp).Offset(1) .Resize(, 6) = Array(ComboBox1.Value, ComboBox3.Value, ComboBox4.Value, ComboBox5.Value, TextBox1.Text, TextBox2.Text) End With End With For Each ctl In Me.Controls If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then ctl.Value = vbNullString Next End Sub




Reply With Quote
Bookmarks