Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel-Save As Macro 1

Status
Not open for further replies.

DrMingle

Technical User
May 24, 2009
116
US
I need to create an if then "save as" function.

There are two saves we want:
1. Save As described below in the code - (this works fine)
2. When a revision is noted in worksheet("master appraisal").range (F75) than save save as the following:

Code:
ThisFile = "Visual Audit_" & " " & Range("B65").Text & " " & Replace(Range("B75").Text, "/", "-") & " " & Range("F75").Text
ActiveWorkbook.SaveAs Filename:=ThisFile

We simple need help creating the conditional save based on ("F75")being blank or having the text "Revised Audit" present.

Code:
Sub SaveAsNameDateScore()
If Trim(Range("B65")) = "" Then
  MsgBox "Please enter Specialist Name"
  Exit Sub
End If
If Not IsDate(Range("B74")) Then
  MsgBox "Please enter Audit Completed Date"
  Exit Sub
End If
If Not IsDate(Range("B75")) Then
  MsgBox "Please enter Process Completed Date"
  Exit Sub
End If
If Not IsNumeric(Range("C85")) Then
  MsgBox "Please enter Average Quality Score"
  Exit Sub
End If
If Range("C88") >= 0.95 And Range("C88") <= 1 Then
    ActiveWindow.ScrollWorkbookTabs Position:=xlLast
    Sheets("Quality Seal").Select
    ActiveSheet.Shapes("Picture 2").Select
    Selection.Copy
    ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
    Sheets("Master Appraisal").Select
    Range("J1").Select
    ActiveSheet.PasteSpecial Format:="Picture (JPEG)", Link:=False, _
        DisplayAsIcon:=False
    Selection.ShapeRange.ScaleWidth 0.93, msoFalse, msoScaleFromTopLeft
    Selection.ShapeRange.ScaleHeight 0.93, msoFalse, msoScaleFromTopLeft
    Selection.ShapeRange.ScaleWidth 0.9, msoFalse, msoScaleFromTopLeft
    Selection.ShapeRange.ScaleHeight 0.9, msoFalse, msoScaleFromTopLeft
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 1
    Range("B1").Select
End If

ThisFile = "Visual Audit_" & " " & Range("B65").Text & " " & Replace(Range("B75").Text, "/", "-") & " " & Range("C88").Text
ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub
 


Hi,
Code:
if sheets("master appraisal").range("F75").value ="" then
  'save method 1
else
  'save method 2
end if

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top