LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
JD JD is offline
external usenet poster
 
Posts: 7
Default Loop same formula for different columns?

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?

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
loop over columns kizzie Excel Discussion (Misc queries) 4 August 10th 05 01:31 PM
Selecting columns through a loop GreenInIowa Excel Programming 5 July 22nd 05 04:53 PM
incrementing columns in a loop Mitch Excel Programming 1 June 9th 05 03:40 PM
loop through columns hotherps[_78_] Excel Programming 6 July 23rd 04 11:40 AM
Loop 20 columns Help! Michael168[_106_] Excel Programming 2 July 2nd 04 12:26 PM


All times are GMT +1. The time now is 06:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"