Solved

Excel - Modify a code

Posted on 2013-06-07
2
193 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 48

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 48

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

615 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