0% found this document useful (0 votes)
40 views

Source Code

The Visual Basic code contains two subroutines. The Reset_Form subroutine displays a confirmation message box and resets selected form fields if the user selects "No". The Submit_Details subroutine copies the form field values to a worksheet based on the country selected, increments the row count, clears the form fields, and displays a submission confirmation message.

Uploaded by

Industrial It
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Source Code

The Visual Basic code contains two subroutines. The Reset_Form subroutine displays a confirmation message box and resets selected form fields if the user selects "No". The Submit_Details subroutine copies the form field values to a worksheet based on the country selected, increments the row count, clears the form fields, and displays a submission confirmation message.

Uploaded by

Industrial It
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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

You might also like