+ Reply to Thread
Results 1 to 4 of 4

Copy HTM Files from Closed Workbook and Copy to Active Workbook if Sheet Name=File Name

  1. #1
    Registered User
    Join Date
    04-15-2015
    Location
    South Dakota
    MS-Off Ver
    Microsoft Office 2013
    Posts
    23

    Copy HTM Files from Closed Workbook and Copy to Active Workbook if Sheet Name=File Name

    I need the macro to copy 7 htm files named, -ACH, -AHH, -FSS, -GRR..ect files located in a ACS/Test to my workbook Users\Test if sheet name is equal to -ACH, -AHH, -FSS, -GRR. Trying to do this as its a daily copy and paste for the data. I think the macro below is grabbing the files that match I just need a way to not list each directory where I am copying from as well as not list every page it is pasting to. Is this possible? There is also a pivot I run which has formulas to these documents so trying to make it a fast process. I had a macro to copy in there, but it was copying ACH to a new sheet not the existing one. I closed out and lost the macro. I am copying the whole sheet which due to htm only appears in column A.

    Copy From Here Q:\ACS\Test\11-13-2017-ACH.htm
    Copy From Here Q:\ACS\Test\11-13-2017-AHH.htm
    Paste Here C:\Users\Test\Desktop\Book2.xlsm

    These fixed widths also need applied to htm file.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    04-15-2015
    Location
    South Dakota
    MS-Off Ver
    Microsoft Office 2013
    Posts
    23

    Re: Copy HTM Files from Closed Workbook and Copy to Active Workbook if Sheet Name=File Nam

    [Sub MyMacro(strDesiredWkb As String)

    ActiveSheet.Copy ThisWorkbook.Sheets(Sheets.Count)

    MsgBox strDesiredWkb

    End Sub]


    The macro works only problem I am having is its copying onto a new tab within the workbook instead of pasting into same sheet. So instead of having one tab labeled ACH it has one that says ACH and another that says ACH(2). How do I get the data to paste into the same tab?

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Copy HTM Files from Closed Workbook and Copy to Active Workbook if Sheet Name=File Nam

    But shall it pase preserving current contents, or replacing it?
    And if the second answer new question arises - shall formatting be preserved from existing sheet?

    For instance:
    Please Login or Register  to view this content.
    another:

    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  4. #4
    Registered User
    Join Date
    04-15-2015
    Location
    South Dakota
    MS-Off Ver
    Microsoft Office 2013
    Posts
    23

    Re: Copy HTM Files from Closed Workbook and Copy to Active Workbook if Sheet Name=File Nam

    I am looking to replace. My macro is lacking the connection from when it copies I need a way to take the objfile.name and if equal to tab/sheet name to paste into that tab. Any ideas? I tried to run this, but blacked out my excel.

    Please Login or Register  to view this content.
    Last edited by L_Misty; 12-07-2017 at 05:17 PM.

+ 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] vba code to copy a specific sheet from a closed workbook to the active workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-01-2017, 03:09 AM
  2. [SOLVED] macro to copy specifc sheet in closed workbook to the active sheet
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-07-2017, 09:53 AM
  3. [SOLVED] macro to copy active sheet to a closed workbook in a specified directory
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-30-2017, 04:43 AM
  4. [SOLVED] vba copy specific sheet from closed workbook to active workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-12-2017, 01:33 PM
  5. [SOLVED] copy specific sheet from closed workbook to active workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2017, 10:26 PM
  6. vba copy specific sheet from closed workbook to active workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2017, 02:34 PM
  7. Run Macro in closed workbook and copy specific coloumn in active workbook
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2013, 03:43 AM

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