Results 1 to 6 of 6

My vba Transpose with condition, but its transposing the condition from other range

Threaded View

Franky alta My vba Transpose with... 09-28-2015, 04:18 AM
Franky alta Re: My vba Transpose with... 09-28-2015, 11:49 AM
nilem Re: My vba Transpose with... 09-28-2015, 12:55 PM
MickG Re: My vba Transpose with... 09-28-2015, 01:17 PM
Franky alta Re: My vba Transpose with... 09-28-2015, 03:56 PM
Franky alta Re: My vba Transpose with... 09-28-2015, 01:28 PM
  1. #1
    Registered User
    Join Date
    06-21-2015
    Location
    fort lauderdale, florida
    MS-Off Ver
    2007
    Posts
    77

    My vba Transpose with condition, but its transposing the condition from other range

    Hi,

    I don't know if title of this tread is incorrect (i'm sorry)
    let see if an expert help me a bit on this,i been trying to figure it out but i couldn't find a solution yet.
    Okay, to make the short my story, I have a workbook with 2 sheets Sheet1 ('Records') and Sheet2 ('Output')
    In sheet1 There are 4 pair Column that work in pair :
    Col A and B should work together, Column C&D, E&F, and Col G&H are the Others.
    Example of what i need to achieve on Col A & B
    Col A2:A37 -> have some numbers,
    Col B2:B37 -> from here i'm setting the condition, is like Points or (like Index)
    So, the condition is : Any number from Column A2:A37 In "records" (Sheet1) have the same Condition ID (same Number ID) in Col B2:B37
    Transpose it to "output" (sheet2).
    But the detail is that the Condition ID or (Index) have to be transposed but just Once
    e.i
    Condition ID_
    Col B2:B37__Numbers from Column A2:A37
    ____3 ___> 01 03 05
    ____2 ___> 07 09 11 13 15 17
    ____1 ___> 19 21 23 25 27 29 31 33 35 37 39 41 43 45
    ____0 ___> 47 49 51 53 55 57 59 61 63 65 67 69 71


    This is my code, it's doing the job partially and on the wrong way.
    It's taking The Numbers from Column C but with condition of Column A (It should be Numbers from A with Condition from B)

    Option Explicit
    Sub Transp_IfCondition_AB()
        Dim c As Range
        Dim Currentname As Integer
        Dim Row As Long
        Dim Col As Integer
         
        Sheet2.Range("M3:AG16").ClearContents
         
        For Each c In Range("B2", Range("B38").End(xlUp))
           If c <> Currentname Then
                Row = Row + 2 '<- leave it in +2,depending the value, it Copy Neighbor or not neighboring rows
                Currentname = c
                Col = 13 '<- leave it in 13, depending the value, it start to copy on desired Column
                Sheet2.Cells(Row, Col) = c
                Col = Col + 2 '<-  with value +2,it copy 1 empty Col between ID Name
                Sheet2.Cells(Row, Col) = c.Offset(0, 1)
            Else
                Col = Col + 1 '<-leave it in +1
                Sheet2.Cells(Row, Col) = c.Offset(0, 1)
            End If
        Next c
    End Sub

    Thank you, any help is greatly appreciated !!
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Rows to Colums Transpose with Condition
    By khalidness in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-07-2014, 05:49 AM
  2. open a comment to cell range upon true condition then removing comment on false condition
    By ferrum_equitis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2012, 12:55 AM
  3. [SOLVED] How to transpose under a certain condition
    By hui_hui in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-27-2012, 02:59 AM
  4. Transpose 2 columns to multiple rows with one condition
    By bellone in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-29-2011, 05:00 AM
  5. Replies: 6
    Last Post: 05-06-2010, 10:06 PM
  6. Transpose with condition match
    By mzimit in forum Excel General
    Replies: 0
    Last Post: 03-19-2008, 08:19 AM
  7. Transpose rows and column with condition
    By ananthakumar.e in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-06-2008, 07:45 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