Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'global variable to store which row the last error has added to
- Public SheetName As String
- Public Col, Row As Integer
- Public Function CountRows()
- ' count rows and save as variable
- Rows = 1
- End Function
- Public Function StringValidation(ByVal inp As String, ByVal length As String)
- End Function
- Public Function DateValidation(ByVal inp As String)
- End Function
- Public Function DecimalValidation(ByVal inp As Single)
- End Function
- Public Function EmailValidation(ByVal inp As String)
- End Function
- Public Function PhoneNumberValidation(ByVal inp As String)
- End Function
- Public Function NationalInsuranceValidation(ByVal inp As String)
- End Function
- Public Function IntegerValidation(ByVal inp As String, ByVal length As Integer)
- If IsNumeric(inp) Then
- IntegerValidation = True
- If Len(inp) > 0 And Len(inp) < 255 Then
- If CInt(inp) > 0 Then
- IntegerValidation = True
- Else
- Call AddError("Even another error", Row, Col)
- End If
- Else
- Call AddError("Another Error: ", Row, Col)
- End If
- Else
- Call AddError("Error:", Row, Col)
- End If
- IntegerValidation = False
- End Function
- Sub UserMaster()
- Dim Val As String
- For Col = 1 To 52
- For Row = 2 To 2
- Sheets("Test").Select
- SheetName = "Test"
- Val = Cells(Row, Col)
- Select Case Col
- Case Is = 2
- ' Example
- MsgBox (IntegerValidation(Val, Some_Length))
- Case Else
- End Select
- Next Row
- Next Col
- End Sub
- Sub ValidateUserInput()
- For Each Sheet In Worksheets
- Select Case Sheet.Name
- Case Is = "User Master"
- Call UserMaster
- Case Is = "Customer Master"
- 'Call CustomerMaster
- Case Is = "Department Master"
- 'Call DepartmentMaster
- Case Is = "Department User Master"
- 'Call DepartmentUserMaster
- Case Is = "Project Master"
- 'Call ProjectMaster
- Case Else
- End Select
- Next Sheet
- End Sub
- Public Sub AddError(ByVal ErrorMsg As String, ByVal Row As String, ByVal Col As String)
- MsgBox (ErrorMsg & "- Row: " & Row & " Col: " + Col)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement