LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Saving a worksheet with a condition

Hi,
I have the following macro for a button that saves a file in two locations.
I want to put a condition between the code that would create a pop up message
saying that Date cell (Which is in C6) must be filled before saving the file.

My code is as follows:


Private Sub CmdSubmit_Click()

If MsgBox("Submit: '" & Sheet1.Cells(1, 1) & "?", vbYesNo Or vbQuestion _
Or vbDefaultButton2) = vbYes Then


Application.DisplayAlerts = False
ThisWorkbook.SaveAs "C:\Census\Archive\" & Sheet1.Cells(1, 1).Value &
".xls"
Application.DisplayAlerts = True

Application.DisplayAlerts = False
ThisWorkbook.SaveAs "C:\Census\Batch_Files\" & Sheet1.Cells(1, 2).Value
& ".xls"
Application.DisplayAlerts = True

MsgBox ("File Submitted Successfully")

Application.ActiveWorkbook.Close

End If

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting rows in a worksheet if condition is met destine Excel Discussion (Misc queries) 3 November 20th 08 01:39 PM
Condition for worksheet reference JBoyer Excel Worksheet Functions 5 November 18th 08 05:28 AM
copy row content from one worksheet to another, if a condition met Lorilenore Excel Worksheet Functions 2 May 24th 08 08:36 PM
copy data from 1 worksheet to another based on a condition [email protected] Excel Worksheet Functions 9 September 4th 06 02:45 PM
how to hide section of worksheet based on a condition (e.g. tick . kitepuppet Excel Discussion (Misc queries) 2 March 4th 05 06:30 PM


All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"