+ Reply to Thread
Results 1 to 9 of 9

Transpose skipping columns.

Hybrid View

JapanDave Transpose skipping columns. 11-13-2011, 11:15 PM
MarvinP Re: Transpose skipping... 11-14-2011, 12:38 AM
JapanDave Re: Transpose skipping... 11-14-2011, 06:09 AM
JapanDave Re: Transpose skipping... 11-14-2011, 06:41 AM
JBeaucaire Re: Transpose skipping... 11-14-2011, 12:40 AM
MarvinP Re: Transpose skipping... 11-14-2011, 12:43 AM
JBeaucaire Re: Transpose skipping... 11-14-2011, 01:28 AM
JBeaucaire Re: Transpose skipping... 11-14-2011, 01:23 PM
JapanDave Re: Transpose skipping... 11-14-2011, 11:52 PM
  1. #1
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Transpose skipping columns.

    I have quite a large worksheet where I need to copy peoples names that are listed on sheet1 going down the page. I am trying to copy these names into a layout on sheet2 that will need to have columns skipped when pasting. The amount of columns to skip is uniform for 4 names, between the 4th and 5th name an extra column appears and will be needed to taken into consideration. This same pattern continues on for up to 300+ names.

    For the time being I have posted a small sample file.
    Attached Files Attached Files
    Last edited by JapanDave; 11-14-2011 at 11:52 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,251

    Re: Transpose skipping columns.

    Hey JapanDave....

    Don't do it this way!!!
    You have merged columns on sheet 2 and a very ugly pattern to try to paste/transpose to.

    Does it have to look like your attached? Can't it be something else?

    Would you allow VBA?
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Transpose skipping columns.

    Quote Originally Posted by MarvinP View Post
    Hey JapanDave....

    Don't do it this way!!!
    You have merged columns on sheet 2 and a very ugly pattern to try to paste/transpose to.

    Does it have to look like your attached? Can't it be something else?

    Would you allow VBA?
    Hey, Marvin,

    I know exactly what you mean, I hate merged cells as much as you do. The only other way I could possibly do this is by adding a text box. But that just complicates a macro for me even further me.



    Dave

  4. #4
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Transpose skipping columns.

    Jerry, for some reason your code does not copy the last name in the column. Also, I should have included this in the sample file, but that same pattern continues on sheet two for up to 300 names, I just did not include the layout for 300 names.

    Just in case my explanation is bad I have included what I am trying to say. Sorry for creating extra work.
    Attached Files Attached Files

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Transpose skipping columns.

    Something like this:
    Option Explicit
    
    Sub ParseNames()
    Dim ws2 As Worksheet
    Dim NmRNG As Range, cel As Long, n As Long
    
    Set ws2 = Sheets("Sheet2")
    Set NmRNG = Sheets("Sheet1").Range("C4:C" & Rows.Count).SpecialCells(xlConstants)
    n = 1
    cel = 2
    
    Do While n < NmRNG.Cells.Count
        ws2.Cells(4, cel).Value = NmRNG.Cells(n).Value
        n = n + 1
        cel = cel + 9
        If cel = 38 Then cel = cel + 1
    Loop
    
    End Sub

    Quote Originally Posted by MarvinP
    Would you allow VBA?
    Programming forum implies the OP expects the suggestions be VBA.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,251

    Re: Transpose skipping columns.

    Hey Jerry,

    Copy and Transpose were mentioned in the thread. I guess I'm nearing bedtime and didn't see the Programming section.
    Still - I hate merged cells in his sheet 2 and thenk Japan Dave can do better.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Transpose skipping columns.

    Yep, merged cells I strictly save for "final reports", which appears to be what JapanDave might be constructing here.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Transpose skipping columns.

    My apologies on skipping the last name, forgot the <= in there.
    Option Explicit
    
    Sub ParseNames()
    Dim ws2 As Worksheet
    Dim NmRNG As Range, cel As Long, n As Long
    
    Set ws2 = Sheets("Sheet2")
    Set NmRNG = Sheets("Sheet1").Range("C4:C" & Rows.Count).SpecialCells(xlConstants)
    n = 1
    cel = 2
    
    Do While n <= NmRNG.Cells.Count
        ws2.Cells(4, cel).Value = NmRNG.Cells(n).Value
        n = n + 1
        cel = cel + 9
        If IsNumeric(ws2.Cells(8, cel)) Then cel = cel + 1
    Loop
    
    End Sub

  9. #9
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Transpose skipping columns.

    Thanks Jerry , that did the trick.

+ 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