Solved

Excel - Modify a code

Posted on 2013-06-07
2
188 Views
Last Modified: 2013-06-07
Hi - below is code that was provided to copy formulas staring in column F. This code would skip to column and copy the formula until the end. I now need to modify the code so that it starts in column E. What do I need to modify? Below the code is my original questions to which the below code was provided.


Sub CopyX()
Dim i As Long, Start As Long, Finish As Long
Dim rg As Range
Application.ScreenUpdating = False
Start = Columns("F").Column
Finish = Columns("YJ").Column - Start
Set rg = Range("F696:F1356")
For i = 3 To Finish Step 3
    rg.Copy
    rg.Offset(0, i).PasteSpecial xlPasteFormulas
Next
End Sub

Original question
Hi, I want to copy the contents from Column X1 to X2, X3,X4 till the end of my last column. X1 starts in column F696 and it goes down to F1356. The last column is YJ. There are two empty columns between each X. Can this be down with a macro, a loop, or code?
conernesto.

X1      b      b      X2      b      b      X3      b      b      X4
100                  100                  100                  100
200                  200                  200                  200
300                  300                  300                  300
0
Comment
Question by:Conernesto
  • 2
2 Comments
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 39229737
Does this work?
Sub CopyX()
Dim i As Long, Start As Long, Finish As Long
Dim rg As Range
Application.ScreenUpdating = False
Start = Columns("E").Column
Finish = Columns("YJ").Column - Start
Set rg = Range("E696:E1356")
For i = 3 To Finish Step 3
    rg.Copy
    rg.Offset(0, i).PasteSpecial xlPasteFormulas
Next
End Sub

Open in new window

0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 39230634
You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2013
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now