+ Reply to Thread
Results 1 to 5 of 5

Vb macro code for transposing the data

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-23-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    106

    Vb macro code for transposing the data

    Dear Sir /Madam,
    I need my data to get transposed in such a way that I gave the output model for you in the excel sheet which I attached for your easy understanding along with this thread request.

    Please do help me and please do find the attachment..

    Thanks & Regards,
    Dharani.
    SENEGAL_DATA.xls

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Vb macro code for transposing the data

    check please your data, there are some months missing. i-e 1990 dec
    try this code
    Sub Macro1()
    LR = Cells(Rows.Count, "D").End(xlUp).Row
    dcol = 42
    For j = 2 To LR Step 12
      drow = 2
      Cells(1, dcol) = Cells(j, 3)
      For r = j To j + 11
        Range("D" & r & ":AI" & r).Copy
        Cells(drow, dcol).Select
        Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
            False, Transpose:=True
        drow = drow + 32
      Next
    '  Stop
      dcol = dcol + 1
    Next
    End Sub
    Last edited by patel45; 11-20-2013 at 05:43 AM. Reason: stop eliminated
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor
    Join Date
    07-23-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    106

    Re: Vb macro code for transposing the data

    Quote Originally Posted by patel45 View Post
    check please your data, there are some months missing. i-e 1990 dec
    try this code
    Sub Macro1()
    LR = Cells(Rows.Count, "D").End(xlUp).Row
    dcol = 42
    For j = 2 To LR Step 12
      drow = 2
      Cells(1, dcol) = Cells(j, 3)
      For r = j To j + 11
        Range("D" & r & ":AI" & r).Copy
        Cells(drow, dcol).Select
       Stop
      dcol = dcol + 1
    Next
    End Sub
    Dear Patel,
    this is how your output looks.... but January is going at the end after 3 years. i need it on the top. (like in 1987,1988,1989) . and also it is showing error in the code at STOP. and for each and every year i have to click run run run run only then it is giving the output. i need like by one click it has to give the output for all the years. for your easy understanding I am attaching you the excel file by running your code.

    pls do help me..
    Awaiting for the positive response...

    With Regards, SENEGAL_DATA(patel sir).xls
    Dharani.

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Vb macro code for transposing the data

    eliminate please the row with stop, but you did not answer to my note "check please your data, there are some months missing. i-e 1990 dec", if some month is missing the code does not work

  5. #5
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Vb macro code for transposing the data

    Hi,

    Looking at the size of the data, how long does it take to complete the transposing for 1 sheet ?
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

+ 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 help for transposing data and deleting rows
    By Winky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-21-2012, 01:03 PM
  2. transposing data via a VBA macro
    By stubyh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-06-2012, 03:15 PM
  3. [SOLVED] Macro for transposing rows of data into columns
    By heiny1056 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2012, 10:07 PM
  4. Help with Macro---transposing data
    By helmet5 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-28-2011, 04:40 PM
  5. macro for transposing data
    By ElaineYKwan@gmail.com in forum Excel General
    Replies: 1
    Last Post: 01-04-2006, 04:20 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