Visual Basic Source Code
Sub Reset_Form()
Dim iMessage As VbMsgBoxResult
iMessage = MsgBox("Do you want to reset this form?", vbYesNo + vbQuestion, "Reset Confirmation")
If iMessage = vbNo Then Exit Sub
ThisWorkbook.Sheets("Form").Range("H7, H9, H11, H13, H15, H17,H20, H23, H25, H27").Value = ""
End Sub
Sub Submit_Details()
Dim shCountry As Worksheet Dim shForm As Worksheet
Dim iCurrentRow As Integer Dim sCountryName As String
Set shForm = ThisWorkbook.Sheets("Form") sCountryName = shForm.Range("H7").Value
Set shCountry = ThisWorkbook.Sheets(sCountryName)
iCurrentRow = shCountry.Range("A" & Application.Rows.Count).End(xlUp).Row + 1
With shCountry
.Cells(iCurrentRow, 1) = iCurrentRow - 1 .Cells(iCurrentRow, 2) = shForm.Range("H9")
.Cells(iCurrentRow, 3) = shForm.Range("H7")
.Cells(iCurrentRow, 4) = shForm.Range("H11")
.Cells(iCurrentRow, 5) = shForm.Range("H13") .Cells(iCurrentRow, 6) = shForm.Range("H17")
.Cells(iCurrentRow, 7) = shForm.Range("H20") .Cells(iCurrentRow, 8) = shForm.Range("H25")
.Cells(iCurrentRow, 9) = shForm.Range("H27")
.Cells(iCurrentRow, 10) = Format([Now()], "DD-MMM-YYYY HH:MM:SS")
End With
shForm.Range("H7, H9, H11, H13, H15, H17,H20, H23, H25, H27").Value = ""
MsgBox "Data submitted successfully!"
End Sub