Results 1 to 2 of 2

Macro to loop through data validation saving extract results as text files

Threaded View

  1. #1
    Registered User
    Join Date
    04-10-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    1

    Macro to loop through data validation saving extract results as text files

    Hello,

    This is my first VBA attempt so it may not be pretty, but I appreciate any help.

    I have a file that contains a toggle which allows the user to select various views. For each view, a tab in the spreedsheet needs to be copied to a new workbook and saved as a text file. I have managed to get the copy / paste / save portion of the code pieced together as per below:

    PHP Code: 
    Sub TextFileCreation()
    '
    TextFileCreation Macro
    '
    Keyboard ShortcutCtrl+Shift+J
    '
     
     ActiveWorkbook.Sheets("EXPORT FILE_DO NOT CHANGE").Activate
     ActiveSheet.Copy
        With ActiveSheet.UsedRange
            .Copy
            .PasteSpecial xlValues
            .PasteSpecial xlFormats
        End With
        Application.CutCopyMode = False

    ActiveWorkbook.SaveAs Filename:=Range("B5").Value, FileFormat:=xlTextWindows
    ActiveWorkbook.Close

    ActiveWorkbook.Sheets("SAP LoadFile").Activate
     

    End Sub 

    I would like the above action to loop through the data validation options (Data validation list is located in cell B5 of the 'SAP LoadFile' tab - list reference is located on 'Drop Down' tab in cells A1:A71 - range is named 'Store'). until all possible views provided by the drop down list are saved as text files.

    One additional teak if possible is that in the above code I have not figured out how indicate which folder to save to - if fix for this is available that would be great as well.

    Thank you for your help in advance.
    Last edited by Jugo; 04-11-2013 at 06:43 PM.

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