Good Day to all,
I am new to VBA, I have Budget data in sheet1 as follow
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD]P[/TD]
[TD]Q[/TD]
[TD]R[/TD]
[TD]S[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Comp[/TD]
[TD]Div[/TD]
[TD]Acct[/TD]
[TD]CC[/TD]
[TD]PG[/TD]
[TD]Dim[/TD]
[TD]CURR[/TD]
[TD]Jan[/TD]
[TD]Feb[/TD]
[TD]Mar[/TD]
[TD]Apr[/TD]
[TD]May[/TD]
[TD]Jun[/TD]
[TD]Jul[/TD]
[TD]Aug[/TD]
[TD]Sep[/TD]
[TD]Oct[/TD]
[TD]Nov[/TD]
[TD]Dec[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]905[/TD]
[TD]101[/TD]
[TD]4100[/TD]
[TD]UC000[/TD]
[TD]526[/TD]
[TD]LU1[/TD]
[TD]USD[/TD]
[TD]52[/TD]
[TD]58[/TD]
[TD]53[/TD]
[TD]63[/TD]
[TD]57[/TD]
[TD]56[/TD]
[TD]53[/TD]
[TD]59[/TD]
[TD]57[/TD]
[TD]63[/TD]
[TD]69[/TD]
[TD]72[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]905[/TD]
[TD]102[/TD]
[TD]4215[/TD]
[TD]UC526[/TD]
[TD]313[/TD]
[TD]LO1[/TD]
[TD]USD[/TD]
[TD]14[/TD]
[TD]17[/TD]
[TD]16[/TD]
[TD]19[/TD]
[TD]12[/TD]
[TD]23[/TD]
[TD]17[/TD]
[TD]16[/TD]
[TD]15[/TD]
[TD]12[/TD]
[TD]19[/TD]
[TD]21[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I want to copy this into sheet 2 using loop because sheet 1 is so long, I record the following code.
****** id="cke_pastebin" style="position: absolute; top: 89.6px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">[TABLE="width: 500"]
<tbody>[TR]
[TD]905[/TD]
[/TR]
</tbody>[/TABLE]
Help please
I am new to VBA, I have Budget data in sheet1 as follow
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD]P[/TD]
[TD]Q[/TD]
[TD]R[/TD]
[TD]S[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Comp[/TD]
[TD]Div[/TD]
[TD]Acct[/TD]
[TD]CC[/TD]
[TD]PG[/TD]
[TD]Dim[/TD]
[TD]CURR[/TD]
[TD]Jan[/TD]
[TD]Feb[/TD]
[TD]Mar[/TD]
[TD]Apr[/TD]
[TD]May[/TD]
[TD]Jun[/TD]
[TD]Jul[/TD]
[TD]Aug[/TD]
[TD]Sep[/TD]
[TD]Oct[/TD]
[TD]Nov[/TD]
[TD]Dec[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]905[/TD]
[TD]101[/TD]
[TD]4100[/TD]
[TD]UC000[/TD]
[TD]526[/TD]
[TD]LU1[/TD]
[TD]USD[/TD]
[TD]52[/TD]
[TD]58[/TD]
[TD]53[/TD]
[TD]63[/TD]
[TD]57[/TD]
[TD]56[/TD]
[TD]53[/TD]
[TD]59[/TD]
[TD]57[/TD]
[TD]63[/TD]
[TD]69[/TD]
[TD]72[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]905[/TD]
[TD]102[/TD]
[TD]4215[/TD]
[TD]UC526[/TD]
[TD]313[/TD]
[TD]LO1[/TD]
[TD]USD[/TD]
[TD]14[/TD]
[TD]17[/TD]
[TD]16[/TD]
[TD]19[/TD]
[TD]12[/TD]
[TD]23[/TD]
[TD]17[/TD]
[TD]16[/TD]
[TD]15[/TD]
[TD]12[/TD]
[TD]19[/TD]
[TD]21[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I want to copy this into sheet 2 using loop because sheet 1 is so long, I record the following code.
****** id="cke_pastebin" style="position: absolute; top: 89.6px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">[TABLE="width: 500"]
<tbody>[TR]
[TD]905[/TD]
[/TR]
</tbody>[/TABLE]
Code:
Sub Macro8()
'
' Macro8 Macro
'
'
Sheets("B").Select
Range("H2:S2").Copy
Sheets ("BM3"), Range("L1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Application.CutCopyMode = False
Selection.Copy
Range("M1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("B").Select
Range("H1:S1").Select
Selection.Copy
Sheets("BM3").Select
Range("N1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Sheets("B").Select
Range("A2:F2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("BM3").Select
Range("A1:A12").Select
ActiveSheet.Paste
''''''''''''''''''''''''''''''''''
Sheets("B").Select
Range("H3:S3").Select
Selection.Copy
Sheets("BM3").Select
Range("L13").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Application.CutCopyMode = False
Selection.Copy
Range("M13").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("B").Select
Range("$H$1:$S$1").Select
Selection.Copy
Sheets("BM3").Select
Range("N13").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Sheets("B").Select
Range("A3:F3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("BM3").Select
Range("A13:A24").Select
ActiveSheet.Paste
''''''''''''''''''''''''''''''''''
Sheets("B").Select
Range("H4:S4").Select
Selection.Copy
Sheets("BM3").Select
Range("L25").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Application.CutCopyMode = False
Selection.Copy
Range("M25").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("B").Select
Range("$H$1:$S$1").Select
Selection.Copy
Sheets("BM3").Select
Range("N25").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Sheets("B").Select
Range("A4:F4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("BM3").Select
Range("A25:A36").Select
ActiveSheet.Paste
''''''''''''''''''''''''''''''''''
End Sub
Help please
Last edited by a moderator: