+ Reply to Thread
Results 1 to 4 of 4

Need Header to be saved to each file and have it saved to same folder not my desk top

  1. #1
    Registered User
    Join Date
    07-02-2019
    Location
    USA
    MS-Off Ver
    2019
    Posts
    19

    Need Header to be saved to each file and have it saved to same folder not my desk top

    Need Header to be saved to each file and have it saved to same folder not my desk top other than those it works spliting them into 100 rows per new file.

    Sub t()
    Dim i As Long
    With ActiveSheet
    For i = 1 To .Cells(Rows.Count, 1).End(xlUp).Row Step 100
    Workbooks.Add
    .Rows(i).Resize(100).Copy
    ActiveWorkbook.Sheets(1).Range("A1").PasteSpecial xlPasteValuesAndNumberFormats
    ActiveWorkbook.SaveAs "Split" & i & ".xlsx", FileFormat:=51
    ActiveWorkbook.Close False
    Next
    End With
    End Sub
    Last edited by spudn56; 05-08-2020 at 04:17 PM. Reason: add sample sheet

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,858

    Re: Need Header to be saved to each file and have it saved to same folder not my desk top

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    07-02-2019
    Location
    USA
    MS-Off Ver
    2019
    Posts
    19

    Re: Need Header to be saved to each file and have it saved to same folder not my desk top

    I don't know much about coding a friend sent me that but he didn't know how to add the header row to all the sheets and keep them from going to my desktop. I don't understand how to tag the code. It did run but didn't include the header as I stated and puts all files on my desk top instead of the folder I ran the file from.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,858

    Re: Need Header to be saved to each file and have it saved to same folder not my desk top

    I think my instructions are clear on how to add the code tags. Re-read the post. Then re-read the forum rules you agreed to when you joined this forum and abide by them in the future.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Message to show name of file saved as a folder
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-07-2020, 10:47 AM
  2. Macro won’t open file it had created earlier
    By ILoveStMartin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2019, 03:26 AM
  3. Opening the most recent file saved to a folder
    By athyeh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2015, 08:50 PM
  4. VBA open yesterdays saved file in a specific folder
    By forfiett in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2014, 08:17 AM
  5. VBA to copy multiples txt file saved in the same folder
    By alexxgalaxy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2013, 08:44 AM
  6. Replies: 0
    Last Post: 04-16-2012, 10:57 AM
  7. Column Header to = Saved File's Title
    By wmfinance in forum Excel General
    Replies: 4
    Last Post: 08-13-2010, 02:30 PM

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