+ Reply to Thread
Results 1 to 8 of 8

VBA code to transpose same cell range from all worksheets of a workbook on a new worksheet

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Mauritius
    MS-Off Ver
    Excel 2010
    Posts
    116

    VBA code to transpose same cell range from all worksheets of a workbook on a new worksheet

    Hi all,

    I'm using Excel 2013. I would be grateful if someone could help with a VBA code that will perform the following task:

    I have a workbook which contains 10 worksheets, each with a specific name. I need to transpose the data located in cells B4 to M4 of each worksheet into a new worksheet. Also, it would be great if the VBA code could fill the name of the specific worksheet alongside each transposed cell.

    In other words, say, worksheet 1 is called "Europe", the transposed data (from B2 to M2) would have "France" in column B next to each cell of the new worksheet, followed by same principle for the Worksheet 2, and so on.

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

    Re: VBA code to transpose same cell range from all worksheets of a workbook on a new works

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Mauritius
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: VBA code to transpose same cell range from all worksheets of a workbook on a new works

    Thanks John. Works partially as it just copy and paste the data but do not transpose it into a vertical format.

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

    Re: VBA code to transpose same cell range from all worksheets of a workbook on a new works

    It would help to understand your layout if you could provide a sample with a before the macro is run and after. Try.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Mauritius
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: VBA code to transpose same cell range from all worksheets of a workbook on a new works

    Thanks again, John. You are right about including a sample for a better understanding of my needs. Please find attached a sample.

    Worksheet named "new worksheet" is what I need as the final output of the VBA code. Thanks for looking into the issue again.

    sample for excel forum.xlsx

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VBA code to transpose same cell range from all worksheets of a workbook on a new works

    Hi, zicitron,

    the sample provided differs from the description you posted - so any effort from our side will fail as we don´t know how your workbook looks like.

    Maybe try:
    Please Login or Register  to view this content.
    You may comment out the code line to ClearContents if you want to keep the data.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: VBA code to transpose same cell range from all worksheets of a workbook on a new works

    Something like this might work also.
    No sheet is added as in John's code. You can add that if you need/want to.
    Please Login or Register  to view this content.

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VBA code to transpose same cell range from all worksheets of a workbook on a new works

    Hi, jolivanes,

    thanks for postiung - as I mixed up my code with Sheets (containing all sheets including charts and macros) and Worksheets and again am not able (and shoulddn´t alter) my post here are two adapeted codes:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Ciao,
    Holger

+ 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. VBA code to copy, paste and transpose every 5th row from multiple worksheets
    By cog38 in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 03-23-2015, 02:28 PM
  2. Replies: 1
    Last Post: 03-27-2014, 06:59 PM
  3. [SOLVED] VBA code to copy cell range from all worksheets for multiple workbooks
    By Beany213 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-21-2013, 12:34 PM
  4. [SOLVED] Select range and then transpose to a new worksheet
    By T15K in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-29-2012, 06:27 AM
  5. Replies: 1
    Last Post: 05-11-2011, 11:07 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