Hi I need help to activate the cancel button in input box to do the comaand "EXIT" in macro here is the macro and no case sensitvityin inputboxes pls tanks
[code=vb]
Sub Auto_Open()
Dim Name As String
Dim P As String
Dim Amount As Double
Dim Cnt01 As Integer
Dim Cello1 As String
Dim Formula01 As String
'
For Cnt01 = 1 To 40
Cell01 = "D1"
Range(Cell01).S elect
Name = InputBox("Inser t Name or [EXIT] to exit")
If Name = "EXIT" Then
Exit For
End If
ActiveCell.Form ulaR1C1 = Name
Cell01 = "D2"
Range(Cell01).S elect
Name = InputBox("Inser t Rate Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D3"
Range(Cell01).S elect
Name = InputBox("Inser t Normal Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D4"
Range(Cell01).S elect
Name = InputBox("Inser t Over Time Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D5"
Range(Cell01).S elect
Name = InputBox("Inser t Sunday Time Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D6"
Range(Cell01).S elect
Name = InputBox("Inser t Leave Bonus Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D7"
Range(Cell01).S elect
Name = InputBox("Inser t Bonus Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D8"
Range(Cell01).S elect
Name = InputBox("Inser t P.A.Y.E. Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D9"
Range(Cell01).S elect
Name = InputBox("Inser t S.I.R.A. Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D10"
Range(Cell01).S elect
Name = InputBox("Inser t U.I.F. Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D11"
Range(Cell01).S elect
Name = InputBox("Inser t Loans Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D12"
Range(Cell01).S elect
Name = InputBox("Inser t Tea Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D13"
Range(Cell01).S elect
Name = InputBox("Inser t Polis Amount")
Amount = Val(Name)
Cell01 = "D14"
Range(Cell01).S elect
Name = InputBox("Inser t Name or [P] to print")
If Name = "P" Then
ActiveSheet.Pag eSetup.PrintAre a = "$A$16:$H$4 0"
Range("G37").Se lect
ActiveWindow.Se lectedSheets.Pr intOut Copies:=1, Collate:=True
End If
fileSaveName = Application.Get SaveAsFilename( _
fileFilter:="Te xt Files (*.txt), *.txt")
If fileSaveName <> False Then
MsgBox "Save as " & fileSaveName
End If
Next Cnt01
End Sub[/code]
[code=vb]
Sub Auto_Open()
Dim Name As String
Dim P As String
Dim Amount As Double
Dim Cnt01 As Integer
Dim Cello1 As String
Dim Formula01 As String
'
For Cnt01 = 1 To 40
Cell01 = "D1"
Range(Cell01).S elect
Name = InputBox("Inser t Name or [EXIT] to exit")
If Name = "EXIT" Then
Exit For
End If
ActiveCell.Form ulaR1C1 = Name
Cell01 = "D2"
Range(Cell01).S elect
Name = InputBox("Inser t Rate Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D3"
Range(Cell01).S elect
Name = InputBox("Inser t Normal Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D4"
Range(Cell01).S elect
Name = InputBox("Inser t Over Time Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D5"
Range(Cell01).S elect
Name = InputBox("Inser t Sunday Time Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D6"
Range(Cell01).S elect
Name = InputBox("Inser t Leave Bonus Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D7"
Range(Cell01).S elect
Name = InputBox("Inser t Bonus Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D8"
Range(Cell01).S elect
Name = InputBox("Inser t P.A.Y.E. Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D9"
Range(Cell01).S elect
Name = InputBox("Inser t S.I.R.A. Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D10"
Range(Cell01).S elect
Name = InputBox("Inser t U.I.F. Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D11"
Range(Cell01).S elect
Name = InputBox("Inser t Loans Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D12"
Range(Cell01).S elect
Name = InputBox("Inser t Tea Amount")
Amount = Val(Name)
ActiveCell.Form ulaR1C1 = Amount
Cell01 = "D13"
Range(Cell01).S elect
Name = InputBox("Inser t Polis Amount")
Amount = Val(Name)
Cell01 = "D14"
Range(Cell01).S elect
Name = InputBox("Inser t Name or [P] to print")
If Name = "P" Then
ActiveSheet.Pag eSetup.PrintAre a = "$A$16:$H$4 0"
Range("G37").Se lect
ActiveWindow.Se lectedSheets.Pr intOut Copies:=1, Collate:=True
End If
fileSaveName = Application.Get SaveAsFilename( _
fileFilter:="Te xt Files (*.txt), *.txt")
If fileSaveName <> False Then
MsgBox "Save as " & fileSaveName
End If
Next Cnt01
End Sub[/code]
Comment