J
JD
Hi,
I have a macro, part of which copies from one worksheet and pastes into
another. The problem is that not only does it have to follow the same
process (copy position moves nine columns, but the destination column
moves two columns and then every fourth change, changes four) and I
know it is poor coding to simply write it out fifteen times.
An extract of the draft is provided below to give an indication:
//--->
Sheets("Sheet1").Range("J10:J100"). _
SpecialCells(xlCellTypeFormulas, 23).Copy
Sheets("Sheet2").Range("F4").PasteSpecial _
Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Sheets("Sheet1").Range("S10:S100"). _
SpecialCells(xlCellTypeFormulas, 23).Copy
Sheets("Sheet2").Range("H4").PasteSpecial _
Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Sheets("Sheet1").Range("AB10:AB100"). _
SpecialCells(xlCellTypeFormulas, 23).Copy
Sheets("Sheet2").Range("J4").PasteSpecial _
Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Sheets("Sheet1").Range("AK10:AK100"). _
SpecialCells(xlCellTypeFormulas, 23).Copy
Sheets("Sheet2").Range("N4").PasteSpecial _
Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
--->//
What I was hoping to do was change all this to a loop utilising
ActiveCell.Offset
Would this work and how should I do it?
I have a macro, part of which copies from one worksheet and pastes into
another. The problem is that not only does it have to follow the same
process (copy position moves nine columns, but the destination column
moves two columns and then every fourth change, changes four) and I
know it is poor coding to simply write it out fifteen times.
An extract of the draft is provided below to give an indication:
//--->
Sheets("Sheet1").Range("J10:J100"). _
SpecialCells(xlCellTypeFormulas, 23).Copy
Sheets("Sheet2").Range("F4").PasteSpecial _
Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Sheets("Sheet1").Range("S10:S100"). _
SpecialCells(xlCellTypeFormulas, 23).Copy
Sheets("Sheet2").Range("H4").PasteSpecial _
Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Sheets("Sheet1").Range("AB10:AB100"). _
SpecialCells(xlCellTypeFormulas, 23).Copy
Sheets("Sheet2").Range("J4").PasteSpecial _
Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Sheets("Sheet1").Range("AK10:AK100"). _
SpecialCells(xlCellTypeFormulas, 23).Copy
Sheets("Sheet2").Range("N4").PasteSpecial _
Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
--->//
What I was hoping to do was change all this to a loop utilising
ActiveCell.Offset
Would this work and how should I do it?