Link to home
Start Free TrialLog in
Avatar of Rayne
RayneFlag for United States of America

asked on

Tranpose With Spaces

Hello All,

I have got the code that does this so far – transpose column to a single row of dates. But I have a spacing thing. Need three months followed by a empty cell. For example >>
The transposed numbers need to be in this way – after the first three months, there is a empty cell, then followed by the next three months and an empty cell.

Prior Related Question: http:Q_27827545.html
tranposeAtSpaces.xlsm
spacesHow.png
Avatar of Rayne
Rayne
Flag of United States of America image

ASKER

something like this
   For i = LBound(X) To UBound(X)
       
            If i = 4 Or i = 8 Or i = 12 Then
                rng.Cells(i).Offset(, 1).Value = X(i, 1)
                i = i + 1
            Else
                rng.Cells(i).Value = X(i, 1)
            End If
           
        Next


I am still not getting it
Avatar of Tommy Kinard
This works
For i = LBound(X) To UBound(X)
            
            If LnCnt = 3 Then
                Ad = Ad + 1
                LnCnt = 0
            End If
            rng.Cells(i + Ad).Value = X(i, 1)
            LnCnt = LnCnt + 1
        Next

Open in new window

SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rayne

ASKER

Hello Everyone :)

Dragontooth thank you for your code. I noticed when I call the macro, i get a last three months on the next line, instead of the same line as other months. I am not sure why thats doing it. See image attached.

 Aikimark - Sure, Please go ahead and make the suggestions as you indicated. I will go with the best practices as much has possible

Thank you all

Respectfully,
R
tranposeNextLine.png
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rayne

ASKER

Thank you both for the efforts. This got moving finally. Greatly appreciate your help on this.
Respect
R