Results 1 to 5 of 5

MACRO - Save Filename & Location based on Cell value

Threaded View

  1. #1
    Registered User
    Join Date
    10-21-2014
    Location
    Makati
    MS-Off Ver
    MS365
    Posts
    74

    MACRO - Save Filename & Location based on Cell value

    Hi everyone.

    I have a code here that I've been working on. The problem here is that it always end up in ERROR.

    Here's the code:

    Sub GREEN()
    '
    ' GREEN Macro
    '
    ' Keyboard Shortcut: Ctrl+Shift+G
    Sheets("LIST").Activate
    Range("A1").Select
    
    Do While True
        If Selection.Value = "" Then
            Exit Do
        Else
            Selection.Copy
            Sheets("2307").Activate
            Range("A1").Activate
            ActiveSheet.Paste
    
            Dim SaveTo As String
            Dim SaveAs As String
    
            SaveTo = "H:\TEST\" & ActiveSheet.Range("B20").Value & "\"
            SaveAs = ActiveSheet.Range("B20").Value & "-" & Format([B1], "mm.dd.yyyy")
    
            ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
            Filename:=SaveTo & SaveAs & ".pdf", _
            OpenAfterPublish:=False
    
    
    
            Sheets("LIST").Activate
            Selection.Offset(1, 0).Select
    
        End If
    Loop
    End Sub
    Hope you can help me.
    Last edited by acerlaptop; 02-14-2020 at 05:07 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Convert sheets to pdf. Filename and location path based on a cell
    By Elainefish in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2019, 01:55 AM
  2. Automate IE11 Save As with save location and filename
    By dband in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2017, 06:11 AM
  3. Save as macro with location and filename
    By realrookie in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-21-2015, 10:16 AM
  4. [SOLVED] Print payslip as pdf and save filename based on a cell value
    By macnabong in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2014, 08:52 AM
  5. [SOLVED] macro to 'save as pdf' that prompts for filename, location AND only prints specified range
    By mtcolombo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2013, 01:49 PM
  6. macro to save sheet from workbook. Specified location and filename
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2011, 11:47 PM
  7. Macro to Save As with filename based on cell contents.
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-22-2006, 06:10 AM

Tags for this Thread

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