+ Reply to Thread
Results 1 to 8 of 8

VBA/Macro to pull referenced sheet name into new sheet

  1. #1
    Registered User
    Join Date
    09-11-2014
    Location
    wyoming
    MS-Off Ver
    2013
    Posts
    4

    VBA/Macro to pull referenced sheet name into new sheet

    Hello everyone -
    I have never posted on this forum but use it often. Hope to find an easy answer to my problem.

    I have copied/pasted a macro into my excel2011 workbook. It is the following:
    Please Login or Register  to view this content.
    What this does is create a new sheet at the end of my workbook, and pulls all the data from each sheet and pastes it in order on the new sheet.

    I would like to add something to this macro that will insert the name of the sheet and puts it in a row right before the data from said sheet is pasted.

    Hope this makes sense - I'll answer any questions that will help my question get answered!

    Thanks so much,
    Lindsey
    Last edited by alansidman; 10-20-2015 at 04:01 PM. Reason: code tags

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: VBA/Macro to pull referenced sheet name into new sheet

    change

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    To create an empty row between data areas (notice the +1). Then add:

    Please Login or Register  to view this content.
    just before the

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-11-2014
    Location
    wyoming
    MS-Off Ver
    2013
    Posts
    4

    Re: VBA/Macro to pull referenced sheet name into new sheet

    Thank you for the quick reply BellyGas!

    I have entered what you said, and the result is Run-time error '1004': Method 'Range of object'_Global' failed.

    Any suggestions?

    Thanks again.

  4. #4
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: VBA/Macro to pull referenced sheet name into new sheet

    When you get that error, click debug and copy the line of code you'll see highlighted into this forum. There'll be a reason like a misstyped character or maybe a variable used in the command doesnt have a value.....but without knowing which line it errors on....

  5. #5
    Registered User
    Join Date
    09-11-2014
    Location
    wyoming
    MS-Off Ver
    2013
    Posts
    4

    Re: VBA/Macro to pull referenced sheet name into new sheet

    Hi BellyGas -
    Thanks again. This is the line of code that is highlighted as error:

    Please Login or Register  to view this content.
    Last edited by alansidman; 10-20-2015 at 04:02 PM.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA/Macro to pull referenced sheet name into new sheet

    Try this one:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-11-2014
    Location
    wyoming
    MS-Off Ver
    2013
    Posts
    4

    Re: VBA/Macro to pull referenced sheet name into new sheet

    Thanks for the reply John!
    It appears that this helped. No error, and the sheet names are pulling in ahead of the sheet data!
    Is there any way to specify formatting for the sheet names (ie, bold, font size, all caps, etc.)?

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,672

    Re: VBA/Macro to pull referenced sheet name into new sheet

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    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

+ 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. Macro redirecting to sheet without being referenced
    By chisox721 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-11-2015, 05:41 PM
  2. [SOLVED] Need Macro to pull data from 1 sheet and filter into another sheet
    By asmithusa in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-15-2014, 04:51 PM
  3. Macro to Pull Info from Product Line Sheet to Purchase Order Sheet
    By JeffreyJr in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-09-2012, 11:16 AM
  4. Replies: 1
    Last Post: 03-01-2011, 03:31 PM
  5. Replies: 4
    Last Post: 04-01-2010, 04:40 PM
  6. Macro - pull data from sheet 1 to sheet 2?
    By Novice_704 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-05-2007, 11:45 PM
  7. Replies: 2
    Last Post: 01-12-2006, 10:35 PM

Tags for this Thread

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