+ Reply to Thread
Results 1 to 2 of 2

MACRO - Paste value and then save file multiple times ---- please help

Hybrid View

  1. #1
    Registered User
    Join Date
    01-02-2013
    Location
    NY
    MS-Off Ver
    Excel Office 365
    Posts
    49

    MACRO - Paste value and then save file multiple times ---- please help

    I have a list of about 30 values in Column A on Sheet1. When I click on a button, I need to have a macro that will do 2 things:
    1) Paste the value of that cell in another cell on sheet2 (Pasted in cell D7)
    2) then save the file in a folder on my hard drive with the YYMM and then the value that was clicked on (ie: 1301xxxxxxxx)

    I need this process to loop through all 30 values in Column A on Sheet1.


    I am hoping someone can assist me with this macro. It is urgent. (Uggghh)

    Thanks in advance. I am hoping that this is quick and easy for someone out there.
    Last edited by aetedford; 01-10-2013 at 09:04 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: MACRO - Paste value and then save file multiple times ---- please help

    Something like this:

    Option Explicit
    
    Sub SaveCopies()
    Dim dRNG As Range, d As Range, savePATH As String
    
    savePATH = "C:\Path\To\Save\File\"              'remember the final \ in this string
    
    Set dRNG = Sheets("Sheet1").Range("A:A").SpecialCells(xlConstants)
    
    For Each d In dRNG
        Sheets("Sheet2").Range("D7").Value = d.Value
        ActiveWorkbook.SaveAs savePATH & Format(Date, "YYMM") & d.Value & ".xlsx", FileFormat:=51
    Next d
    
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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