ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Validate value in cell (https://www.excelbanter.com/excel-programming/273476-validate-value-cell.html)

Mike[_40_]

Validate value in cell
 
I have a commandbutton in a worksheet called "Worksheet"
for the user to press to print a related worksheet
called "Summary", only if the value in cell C81
in "Worksheet" is equal to 0.00 OR negative 0.01. When I
run the below code I receive a Type mismatch error in the
first line of the code. Why??

If Worksheets("Worksheet").Cells("C81").Value = 0 Then
'Print Summary Sheet
Sheets("Summary").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True
Sheets("Worksheet").Select
'ElseIf Worksheets("Worksheet").Cells("C81").Value = -0.01
Then
'Print Summary Sheet
' Sheets("Summary").Select
' ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True
' Sheets("Worksheet").Select
'Else
' MsgBox "Worksheet does not balance.", vbOKOnly +
vbWarning, "ABCInc."
End If
End Sub


TIA
Mike


All times are GMT +1. The time now is 10:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com