Visual Basic Code For The Day (Hourly Pay)

InputBox and Message Box examples

Sub CalcPay() On Error GoTo HandleError Dim hours Dim hourlyPay Dim payPerWeek hours = InputBox("Please enter number of hours worked", "Hours Worked") hourlyPay = InputBox("Please enter hourly pay", "Pay Rate") payPerWeek = CCur(hours * hourlyPay) MsgBox "Pay is: " & Format(payPerWeek, "£##,##0.00"), , "Total Pay" HandleError: 'any error - gracefully end End Sub

Featured Posts