ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help with loop code (https://www.excelbanter.com/excel-programming/370890-need-help-loop-code.html)

confused

Need help with loop code
 
Hi

I am having probs with the following coding...

i need to copy sheet 1 to sheet 2 in the following order over any number of
rows...

sheet one =data sheet
sheet two= destination sheet

Sheet 2 - Col A =ref eg AA, auto fill down 11 rows
sheet 1 -

repeat with sheet 1
Range H2:S2 fixed range, copy and pastespecial transpose into sheet 2 col B
then H4:S4 copy and pastespecial transpose into sheet 2, col C
T4:V4 copy an paste special only across cols E,F&G, then auto fill same data
down 11 rows.


Dim row1
Dim row2
row1 = 2
row2 = 3
Do
Sheets("BIF").Select
Range("A2").Select
ActiveCell.FormulaR1C1 = "BB"
Range("D2").Select
ActiveCell.FormulaR1C1 = "PM Budget Input 2007"
Range("B2").Select

Sheets("DATA").Select
Range("H2:S2").Select
Selection.copy
Sheets("BIF").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True

Range("C2").Select
Sheets("DATA").Select
Range("H3:S3").Select
Application.CutCopyMode = False
Selection.copy
Sheets("BIF").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True

Range("E2").Select
Sheets("DATA").Select
Range("T3:V3").Select
Selection.copy
Sheets("BIF").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

Range("A2").Select
Selection.AutoFill Destination:=Range("A2:A13")

Range("D2:G2").Select
Selection.AutoFill Destination:=Range("D2:G13"), Type:=xlFillCopy
Range("D2:G13").Select


row2 = 2 + 1

Loop Until ActiveCell.Value = ""

End Sub









All times are GMT +1. The time now is 08:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com