View Full Version : [SOLVED:] Special Transpose
ndendrinos
06-22-2008, 04:29 AM
I import data from Access to Excel and end up with many rows that I need to "transpose" in a specific way to do a search.
My example show in the first three rows how the data is imported and staring in A6 how I need to transpose it.
thank you
Bob Phillips
06-22-2008, 04:49 AM
Public Sub ProcessData()
    Const TEST_COLUMN As String = "A"    '<=== change to suit
    Dim i As Long
    Dim LastRow As Long
    Dim LastCol As Long
    With Application
        .ScreenUpdating = False
        .Calculation = xlCalculationManual
    End With
    With ActiveSheet
        LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
        For i = LastRow To 1 Step -1
            LastCol = .Cells(i, .Columns.Count).End(xlToLeft).Column
            If LastCol > 2 Then
                .Rows(i + 1).Resize(LastCol - 2).Insert
                .Cells(i, "C").Resize(, LastCol - 2).Copy
                .Cells(i + 1, "B").PasteSpecial Paste:=xlPasteAll, Transpose:=True
                .Cells(i, "C").Resize(, LastCol - 2).ClearContents
            End If
        Next i
    End With
    With Application
        .CutCopyMode = False
        .Calculation = xlCalculationAutomatic
        .ScreenUpdating = True
    End With
End Sub
ndendrinos
06-22-2008, 05:10 AM
Thank you xld , problem solved in less than 5 minutes.
I'm torn between gratitude and depression.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.