Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi microsoft.public.excel.programming group,
I have a command button the copies cells to a text file. Sometimes the data has not been saved to the text file. I suspect the users have been closing the workbook before pressing the command button. So I tried to this: Private Sub Workbook_BeforeClose(Cancel As Boolean) _____________________________________ With Worksheets("CompleteQuote") Dim rng As Range Set rng = Range("test_range") If rng.Value 0 Then Cancel = True MsgBox ("You still have data that has not been exported. Please cancel.") Else: Cancel = False End If End With End Sub _____________________________________ This returns runtime error 13. Type Mismatch on the following line: If rng.Value 0 Then The range will contain some cells with data and some cells will have no data. Please offer any suggestions or questions. Thanks, Dan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Emailing range in Outlook- so close! just need a little help | Excel Programming | |||
Determine if a value in a range is close to the value of another c | Excel Worksheet Functions | |||
Determine if a value in a range is close to the value of another c | Excel Worksheet Functions | |||
Range ... how to know if it is empty | Excel Programming | |||
Finding next empty empty cell in a range of columns | Excel Programming |