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
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
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
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

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