Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel Copy formulas from one column to another column

Posted on 2013-05-24
7
Medium Priority
?
336 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
[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
  • 4
7 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

705 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