+ Reply to Thread
Results 1 to 13 of 13

Macro to transpose data from one sheet to another

  1. #1
    Registered User
    Join Date
    12-02-2013
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    83

    Macro to transpose data from one sheet to another

    hi

    I need a routine to make sheet1 become sheet 2 as per my example

    i have produced a sample of the work as i can not show the actual data

    anything with xxxx is not needed on the new worksheet
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: Macro to transpose data from one sheet to another

    Try:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-02-2013
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: Macro to transpose data from one sheet to another

    this is my version of the code above to stop subscript errors and it works a little bit how ever some line of data are missing i have attched a screen shot of what it looks like after the code is amended.Ran code.doc

    Sub UpdateFD()


    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Sheets("Financial Difficulties").Cells.Find(" ", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim x As Long
    Dim y As Long
    y = Cells(Rows.count, "A").End(xlUp).Row
    For x = 2 To LastRow
    Sheets("Financial Difficulties").Cells(x, "R").Copy Sheets("FD").Cells(Rows.count, "B").End(xlUp).Offset(1, 0)
    Sheets("FD").Cells(Rows.count, "A").End(xlUp).Offset(1, 0) = y
    Sheets("Financial Difficulties").Cells(x, "V").Copy Sheets("FD").Cells(Rows.count, "C").End(xlUp).Offset(1, 0)
    Sheets("Financial Difficulties").Cells(x, "A").Copy Sheets("FD").Cells(Rows.count, "D").End(xlUp).Offset(1, 0)
    Sheets("Financial Difficulties").Cells(x, "W").Copy Sheets("FD").Cells(Rows.count, "E").End(xlUp).Offset(1, 0)
    Sheets("Financial Difficulties").Cells(x, "L").Copy Sheets("FD").Cells(Rows.count, "L").End(xlUp).Offset(1, 0)
    Sheets("Financial Difficulties").Cells(x, "Z").Copy Sheets("FD").Cells(Rows.count, "M").End(xlUp).Offset(1, 0)
    Sheets("Financial Difficulties").Cells(x, "AA").Copy Sheets("FD").Cells(Rows.count, "N").End(xlUp).Offset(1, 0)
    Sheets("Financial Difficulties").Cells(x, "AB").Copy Sheets("FD").Cells(Rows.count, "O").End(xlUp).Offset(1, 0)
    y = y + 1
    Next x
    Application.ScreenUpdating = True

  4. #4
    Registered User
    Join Date
    12-02-2013
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: Macro to transpose data from one sheet to another

    I also need it to recognise that if Row AB on the Financial Difficulties sheet = Farrah Taheri or Jill slater to ignor that row

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: Macro to transpose data from one sheet to another

    Try the attached file. It looks like it's working properly.
    Attached Files Attached Files

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: Macro to transpose data from one sheet to another

    Do you mean column AB? If so, it contains city names. What column would the names be in?

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to transpose data from one sheet to another

    I have not looked the thread beyond post #1. The attached code is a solution as per the attachment.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    12-02-2013
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: Macro to transpose data from one sheet to another

    sorry meant AA

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: Macro to transpose data from one sheet to another

    Try:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    12-02-2013
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: Macro to transpose data from one sheet to another

    When i have done this i get the same results as my Ran Code.doc

    If i leave the extra out of it everything works fine

    I tried changeing the And to Or as it can be either manager but it is not filling out the other details only what is the my sample

  11. #11
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: Macro to transpose data from one sheet to another

    Try the attached file. I have put Farrah Taheri and Jill Slater in column AA. When I run the macro it copies only rows 2 and 4 and not the rows that contain those names in column AA. I believe that is what you were asking. If your actual worksheet is organised differently, please post your actual file.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    12-02-2013
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: Macro to transpose data from one sheet to another

    I am running the code and getting Application-defined or object-defined error

    On the line

    Sheets("Financial Difficulties").Cells(x, "R").Copy Sheets("FD").Cells(Rows.Count, "B").End(xlUp).Offset(1, 0)

  13. #13
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: Macro to transpose data from one sheet to another

    I'm using the following macro and it works for me.
    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 transpose vertical data horizontally from one sheet to another
    By Scott_88 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-09-2013, 06:27 AM
  2. [SOLVED] How to copy data range form one sheet to other sheet with desire Reverse Transpose ?
    By nur2544 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-18-2013, 12:30 PM
  3. [SOLVED] Macro help with copy/paste and transpose across 3 columns into a 4th - same sheet
    By pharms in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2013, 03:51 PM
  4. [SOLVED] Manipulate and transpose data to another sheet via a Macro
    By Phil_MacRae in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-12-2012, 02:22 PM
  5. Transpose Particular Data drom Sheet 1 to Sheet 2
    By Knawl in forum Excel General
    Replies: 5
    Last Post: 10-01-2009, 04:47 PM

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