+ Reply to Thread
Results 1 to 17 of 17

Transpose Data automatically

Hybrid View

  1. #1
    Registered User
    Join Date
    03-12-2008
    Posts
    76

    Transpose Data automatically

    My data looks like this: (each cell contains 1 item of data)

    Apple
    15
    1
    2
    3
    <blank cell>
    Pear
    1
    3
    4
    7
    <blank cell>

    Etc... for 100's of line. So name of fruit then calorific values underneath

    I need the data to look like this:

    Apple 15 1 2 3
    Pear 1 3 4 7

    Etc..

    Then I can apply Vlookup functions, so if your enter a food name you get all the relevant data.

    Dave32
    Last edited by Dave32; 03-12-2008 at 08:42 AM. Reason: Spelling

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    You should mention when you cross-post so as not to waste people's time.

    http://www.ozgrid.com/forum/showthread.php?t=86474

  3. #3
    Registered User
    Join Date
    03-12-2008
    Posts
    76

    Apolgies

    Sorry, I didn't realise I was on the same website.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Your not on the same website. We just police cross posters. Read forum rules and message to cross posters below to understand why

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Registered User
    Join Date
    03-12-2008
    Posts
    76
    Message understood loud and clear. This will not happen again. I am new to this forum stuff.

    Dave32

  6. #6
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    Hi,

    Not particularly neat and tidy, but this will do the job. Alter the 1000 below according to how many rows you have

    Sub Macro1()
    
    Dim source_row, destination_row As Integer
    For source_row = 0 To 1000 Step 7
    Range(Cells(1, 1).Offset(source_row, 0), Cells(1, 1).Offset(6 + source_row, 0)).Select
        Selection.Copy
        Cells(1, 3).Offset(destination_row, 0).Select
        destination_row = destination_row + 1
            Selection.PasteSpecial Transpose:=True
    Next source_row
    
    End Sub
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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