View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
questor questor is offline
external usenet poster
 
Posts: 17
Default Starting Auto_Close macro based on an IF statement

I'm over my head --
I run an auto_close macro to retrieve and save data collected during a user
session. The macro takes all rows with data, copies them to a folder, then
clears the collection sheet for next session.
If there is NO DATA collected, I want to end the macro right away.
Otherwise, I'm getting an error saying Excel can't move things off the
worksheet because data may be lost . . . to paraphrase I think it's a
runtime error 1004?

Here is what I came up w/, but not sure if it's even close -- it doesn't
work though.

If Sheets("Worksheet") & Range("A3") = "" Then
ActiveWorkbook.Save
ActiveWorkbook.Close
End If
Else
Workbooks.Open Filename:="W:\. . .

Where if A# < "", then I want to run the macro. Any help?