Transpose and PasteLink Macro

arskae

New Member
Joined
Jul 21, 2016
Messages
2
Hello to all of you.
I am new to forum and I hope that my post will be okay.
I have a workbook that contains 13 worksheets. The first sheet's name is T1 and contains data at 13 rows and 45 columns starting from D19.Next sheet's name is T2 and so on until to T13.
I wrote a macro that I want to transpose and paste link from sheet T1 to the other sheets by this way:
D19:L19 sheet T1 to B2:B10 sheet T2.
M19:U19 sheet T1 to C2:C10 sheet T2.
V19:AD19 sheet T1 to D2:D10 sheet T2.
AE19:AM19 sheet T1 to E2:E10 sheet T2.
AN19:AV19 sheet T1 to F2:F10 sheet T2.
Also the same thing for row 20 from sheet T1 to sheet T3, row 21 from sheet T1 to sheet T4 and etc.
The macro is the following:
Code:
Sub b()
Dim i As Integer
Sheets("T2").Select
For i = 1 To 12
Range("B2:B10").Select
Selection.FormulaArray = "=TRANSPOSE(T1!D19: L19)"
Range("C2:C10").Select
Selection.FormulaArray = "=TRANSPOSE(T1!M19:U19)"
Range("D2:D10").Select
Selection.FormulaArray = "=TRANSPOSE(T1!V19:AD19)"
Range("E2:E10").Select
Selection.FormulaArray = "=TRANSPOSE(T1!AE19:AM19)"
Range("F2:F10").Select
Selection.FormulaArray = "=TRANSPOSE(T1!AN19:AV19)"
    ActiveWindow.DisplayZeros = False
    ActiveSheet.Next.Select
    Next i
    End Sub
My problem is that for i=2 I can't find a way to change D19 to D20 , L19 to L20 and so on.
I hope that I explained my problem clearly. I ask if there is a way to change my macro or if there is a better macro to do this. Thanks for your help.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hope this helps.
Code:
Sub arskae()
Dim i  As Long, j As Long, k As Long
Dim x, w
Dim ws As Worksheet
Set ws = Sheets("T1")

i = 19
    For Each w In Worksheets
        If w.Name <> "T1" Then
            With w
                k = 4
                For j = 2 To 6
                    .Range(.Cells(2, j), .Cells(10, j)) = Application.Transpose(ws.Range(ws.Cells(i, k), ws.Cells(i, k + 8)))
                    k = k + 9
                Next
                i = i + 1
            End With
        End If
    Next
End Sub
 
Upvote 0
Thank you very much Takae. Your macro works perfectly and transposes all my data to the other sheets. So there is no need to have paste link them with the sheet T1. Thank you very much again and have a nice day.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top