Private Sub SaveClose_Click()
Dim ws1 As Worksheet: Set ws1 = Sheets("Dashboard")
Dim ws3 As Worksheet: Set ws3 = Sheets("Data")
'transfer combo and text box data
Dim emptyRow As Long
With ws3
emptyRow = WorksheetFunction.CountA(ws3.Range("$C:$C")) + 1
.Cells(emptyRow, 2).Value = Date
.Cells(emptyRow, 3).Value = cbo1.Value
.Cells(emptyRow, 4).Value = cbo2.Value
.Cells(emptyRow, 5).Value = txt1.Value
.Cells(emptyRow, 6).Value = cbo3.Value
.Cells(emptyRow, 7).Value = cbo4.Value
.Cells(emptyRow, 8).Value = txt2.Value
.Cells(emptyRow, 34).Value = txt3.Value
'transfer option buttons data
If option1Y.Value = True Then
.Cells(emptyRow, 13).Value = 1
Else
.Cells(emptyRow, 13).Value = 2
End If
If option2Y.Value = True Then
.Cells(emptyRow, 14).Value = 1
Else
.Cells(emptyRow, 14).Value = 2
End If
If option3Y.Value = True Then
.Cells(emptyRow, 15).Value = 1
Else
.Cells(emptyRow, 15).Value = 2
End If
If option4Y.Value = True Then
.Cells(emptyRow, 16).Value = 1
Else
.Cells(emptyRow, 16).Value = 2
End If
If option5Y.Value = True Then
.Cells(emptyRow, 17).Value = 1
Else
.Cells(emptyRow, 17).Value = 2
End If
If option6Y.Value = True Then
.Cells(emptyRow, 18).Value = 1
Else
.Cells(emptyRow, 18).Value = 2
End If
If option7Y.Value = True Then
.Cells(emptyRow, 19).Value = 1
Else
.Cells(emptyRow, 19).Value = 2
End If
If option8Y.Value = True Then
.Cells(emptyRow, 20).Value = 1
Else
.Cells(emptyRow, 20).Value = 2
End If
If option9Y.Value = True Then
.Cells(emptyRow, 21).Value = 1
Else
.Cells(emptyRow, 21).Value = 2
End If
If option10Y.Value = True Then
.Cells(emptyRow, 22).Value = 1
Else
.Cells(emptyRow, 22).Value = 2
End If
If option11Y.Value = True Then
.Cells(emptyRow, 23).Value = 1
Else
.Cells(emptyRow, 23).Value = 2
End If
If optionOtherY.Value = True Then
.Cells(emptyRow, 24).Value = 1
Else
.Cells(emptyRow, 24).Value = 2
'transfer check boxes data
If chk2.Value = True Then .Cells(emptyRow, 25).Value = 1
If chk3.Value = True Then .Cells(emptyRow, 26).Value = 1
If chk4.Value = True Then .Cells(emptyRow, 27).Value = 1
If chk5.Value = True Then .Cells(emptyRow, 28).Value = 1
If chk6.Value = True Then .Cells(emptyRow, 29).Value = 1
If chk7.Value = True Then .Cells(emptyRow, 30).Value = 1
If chk8.Value = True Then .Cells(emptyRow, 31).Value = 1
If chk9.Value = True Then .Cells(emptyRow, 32).Value = 1
If chk10.Value = True Then .Cells(emptyRow, 33).Value = 1
End If
End With
Unload Me
End Sub
Bookmarks