+ Reply to Thread
Results 1 to 4 of 4

Saving template created workbook based on cell value

Hybrid 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

  2. #2
    Registered User
    Join Date
    10-08-2012
    Location
    Teesside, England
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Saving template created workbook based on cell value

    This might help - http://www.msexcelspreadsheet.com/vi...names_vba.aspx

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

    Re: Saving template created workbook based on cell value

    Excellent! Thank you for such a quick response!

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Saving template created workbook based on cell value

    @ stevecan

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

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