Solved

Excel Copy formulas from one column to another column

Posted on 2013-05-24
7
301 Views
Last Modified: 2013-06-05
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
  • 4
7 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39195329
The two columns between: are they empty or is there any data in there?
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39195339
If there is NO data in the blank columns then you would not need a macro

Select the range F696:H1356          (3 columns)
Now at the bottom left corner of the selection there is a tiny black square.
Drag this black square as far right as necessary.
0
 
LVL 81

Expert Comment

by:byundt
ID: 39195716
It's much faster to copy values. Here's a macro to copy formulas, however:
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

Open in new window

0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39196161
If all the formulas down column F are the same then I believe, although not tested that way, that this would be quicker than copying

Sub cpyColsWgaps()
    Dim i As Integer
    Dim trng As Range
    Set trng = Range("F696:F1356").Offset(, 3)
    For i = 6 To Range("YJ1").Column - 6 Step 3
        Set trng = Union(trng, Range("F696:F1356").Offset(, i))
    Next i
    trng.FormulaR1C1 = Range("F696").FormulaR1C1
End Sub
0
 

Author Closing Comment

by:Conernesto
ID: 39223491
Both solutions worked fine. I like the second solution because it also copies the formats.

conernesto.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39223780
You have selected a comment which is not a solution. Can you specify the serial number of the solution which is working for you?
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
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 in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

813 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

15 Experts available now in Live!

Get 1:1 Help Now