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 !!
Bookmarks