VB help

mharder

New Member
Joined
Feb 7, 2008
Messages
11
Basically I want to transpose vertical data to horizontal. Although not all of the vert cells will not be transposed. The Macro I recorded accomplishes what I want (four tasks only) I just need help continuing the pattern for all 827,011 rows of vertical data.

Sub Macro2()
'
' Macro2 Macro
'

'
Range("C10:C38").Select
Selection.Copy
Range("F8").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Rows("9:43").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp


Range("C11:C39").Select
Selection.Copy
Range("F9").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Rows("10:44").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp


Range("C12:C40").Select
Selection.Copy
Range("F10").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Rows("11:45").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp


Range("C13:C41").Select
Selection.Copy
Range("F11").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Rows("12:46").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
End Sub

Thanks in advance
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

texasalynn

Well-known Member
Joined
May 19, 2002
Messages
8,458
does this work?
Code:
Sub Macro2()
'
Dim LR As Long
LR = Cells(Rows.Count, "C").End(xlUp).Row
For i = 10 To LR
    Range(Cells(i, "C"), Cells(i + 28)).Copy
    Cells(i - 1, "F").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Application.CutCopyMode = False
    x = i - 1
    y = i + 34
    Rows(x & ":" & y).Delete Shift:=xlUp
    LR = Cells(Rows.Count, "C").End(xlUp).Row
Next i
End Sub

note this is untested
also be sure to make a copy of you file before trying code
 

Watch MrExcel Video

Forum statistics

Threads
1,122,969
Messages
5,599,104
Members
414,287
Latest member
Rbwester

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
Top