Results 1 to 4 of 4

Saving template created workbook based on cell value

Threaded View

  1. #1
    Registered User
    Join Date
    10-27-2012
    Location
    toronto canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Saving template created workbook based on cell value

    Hello everyone! First time for me in any Forum! I'm not even sure if i'm doing this right.
    I'm a beginner in VBA but have been getting by with cut/paste and with information from
    Web sources like this forum.
    Intuitivley, what i want to do isn't that complicated but I just can't get the code right!

    Macro opens a new workbook from a .xlsM file.
    User enters values in allowable cells (sheet protected/data validation)
    Now
    1. Save workbook to one of 3 different folders depending on cell data
    2. Name workbook based on cell data.

    SUB QUOTE_COPY3()
    '
    ' QUOTE_COPY3 Macro
    '
    Dim WBQ As Workbook
    Dim WSQ As Worksheet
    Dim WONUM As Range
    Dim STATUS As Range
    Set Range("F5").Name = "WONUM"
    Set Range("F6").Name = "STATUS"
    Set WBQ = ActiveWorkbook 'Workbooks.Add("C:\Users\Steve\AppData\Roaming\Microsoft\Templates\CANQUOTEMPLATE.xltm")
        With WBQ
    If WSQ("STATUS") = "OPEN" Then
        WBQ.SaveAs Filename:=("C:\Users\Steve\documents\Openquotes\ " & WONUM & ".Xls"), FileFormat:=51
     End If
    Else
    If WSQ("STATUS") = "CLOSED" Then
        WBQ.SaveAs Filename:=("C:\Users\Steve\documents\Closedquotes\ " & WONUM & ".Xls"), FileFormat:=51
      End If
    Else
    If WSQ("STATUS") = "PENDING" Then
        WBQ.SaveAs Filename:=("C:\Users\Steve\documents\Pendinquotes\ " & WONUM & ".Xls"), FileFormat:=51
      End If
            End With
    End Sub
    Last edited by Cutter; 10-28-2012 at 02:13 PM. Reason: Corrected code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1