+ Reply to Thread
Results 1 to 2 of 2

Macro to Copy Values from Several Worksheets and Consolidate into 1

  1. #1
    Registered User
    Join Date
    10-01-2019
    Location
    United States
    MS-Off Ver
    MS H/B 2016
    Posts
    1

    Macro to Copy Values from Several Worksheets and Consolidate into 1

    I have several workbooks with approximately 30 worksheets each. I need to copy certain cells (B4, L30, H34, and K63) to paste in another spreadsheet.

    Col A Col B Col C
    0826[B4] 0827[B4]
    X [H34] [H34]
    Y [L30] [L30]
    Z [K63] [K63]

    I created a macro by recording, but I need to be able to either select the worksheet (ie 0826) or significantly more difficult for me have the macro to move on to the next sheet. I will also have to move to the right looking for the next empty cell on the "Combine" sheet. Below is the macro I am starting with. Any guidance would be most appreciated on how to write the macro to move to the next sheet in the original workbook and continue copying and pasting to the right in the combine sheet.

    Sub Macro5()
    '
    ' Macro5 Macro
    '

    '
    Sheets("0826").Select
    Range("B4").Select
    Selection.Copy
    Sheets("Combine").Select
    Range("B1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("0826").Select
    Range("H34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Combine").Select
    Range("B2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("0826").Select
    Range("L30").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Combine").Select
    Range("B3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("0826").Select
    Range("K63").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Combine").Select
    Range("B6").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("0827").Select
    Range("B4").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Combine").Select
    Range("C1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("0827").Select
    Range("H34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Combine").Select
    Range("C2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("0827").Select
    Range("L30").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Combine").Select
    Range("C3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("0827").Select
    Range("K63").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Combine").Select
    Range("C6").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    End Sub

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to Copy Values from Several Worksheets and Consolidate into 1

    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 [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, 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.)

    After you put the code tags on could you:

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    Are the workbooks all in the same folder? Are there any that you don't want to extract from?
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

+ 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] Consolidate Worksheets - Help pasting values
    By exc4libur in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-18-2016, 08:34 PM
  2. Help! Copy, transpose, consolidate data from multiple worksheets
    By indik in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-18-2016, 06:48 AM
  3. Need to consolidate worksheets based of values listed under a name
    By talltxn33647 in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 11-12-2015, 11:13 PM
  4. Replies: 3
    Last Post: 02-25-2013, 08:11 AM
  5. Replies: 1
    Last Post: 06-23-2009, 06:19 PM
  6. Macro to consolidate data from various worksheets into one
    By Archana in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-31-2007, 08:10 AM
  7. Macro to Consolidate Worksheets
    By andrewc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-03-2006, 12:50 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