+ Reply to Thread
Results 1 to 9 of 9

Macro to export tab

  1. #1
    Forum Contributor
    Join Date
    09-11-2012
    Location
    minot, north dakota
    MS-Off Ver
    Excel 2010
    Posts
    118

    Macro to export tab

    wondering if any one could help me with a macro that would export a sheet from active work book to new excel work book. It would be great if it copied over with values only.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to export tab

    You could try and record you own macro.

    here's a a sample

    Please Login or Register  to view this content.
    Found with Goggle, it's not that difficult, you should try it
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Contributor
    Join Date
    09-11-2012
    Location
    minot, north dakota
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: Macro to export tab

    The bold part of the text code fails. I am having trouble saving it to my desk top as tab name which is SM wTX Summary. Can any one help me make this happen?

    C:\Users\Kozar\Desktop

    Can you make it not specific so when this is shared it will save to the others desk top?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to export tab

    [code]
    Sub ExportSummary()

    '~~> Change Sheet1 to the relevant sheet
    '~~> This will create a new workbook with the relevant sheet
    ThisWorkbook.Sheets("SM wTX Summary").Copy

    '~~> Save the new workbook
    ActiveWorkbook.SaveAs ENVIRON$("USERPROFILE") & \Desktop\SM wTX Summary.xlsx", FileFormat:=51
    End Sub

  5. #5
    Forum Contributor
    Join Date
    09-11-2012
    Location
    minot, north dakota
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: Macro to export tab

    I am really close now but the Users\Kozar\ needs to be universal so there computers will work when it is saved through the macro.
    Any help is greatly appreciated

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    09-11-2012
    Location
    minot, north dakota
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: Macro to export tab

    I am really close now but the Users\Kozar\ needs to be universal so there computers will work when it is saved through the macro.
    Any help is greatly appreciated

    Please Login or Register  to view this content.

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to export tab

    The user Kozar is only accessible by the user named Kozar. So if somebody else logs in then .... the user name is 'somebody else'
    The ENVIRON$ steeing takes the current usernama so it will alwasy work

    Readup on environment settings,
    open a command prompt and type SET < Enter > and you'll see them

  8. #8
    Forum Contributor
    Join Date
    09-11-2012
    Location
    minot, north dakota
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: Macro to export tab

    I understand that
    I have tried to insert the ENVIRON$("USERPROFILE") and cant get it to work with out errors and cant
    How would you adjust this code to make it work.


    Please Login or Register  to view this content.

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to export tab

    I put the code i my answer with the red text there was a " missing but you could have figured that out!
    Please Login or Register  to view this content.

+ 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] Macro to export to pdf
    By suedavies in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-19-2018, 05:27 AM
  2. Replies: 1
    Last Post: 09-05-2017, 01:49 PM
  3. Macro to export and import a module and assigning different macro automatically
    By Libster78 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-14-2015, 06:31 PM
  4. Macro to Export a Sheet but also export a macro?
    By ChrisF79 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2013, 12:26 PM
  5. I would need a macro to export data from base example workbook to export worbook
    By slato8 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2012, 11:21 AM
  6. export to csv macro
    By PM4 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-01-2006, 04:30 PM
  7. Macro to Export XML
    By DangerMouse in forum Excel General
    Replies: 1
    Last Post: 04-10-2006, 09:49 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