Solved

MS Excel - Selected Copy Paste

Posted on 2013-01-30
2
225 Views
Last Modified: 2013-02-17
I wish to do selective copy paste from one file to another:

Copy Column A:F from Sheet 1

Paste on Sheet 2, so that

Sheet 1                          Sheet 2
Values of Column A = Values of Column A
Values of Column B = Values of Column C
Values of Column C = Values of Column E ... and so on.

unable to use visible cells only copy paste option. plz. help.

regards.
0
Comment
Question by:peeyushmiglani
2 Comments
 
LVL 45

Expert Comment

by:aikimark
ID: 38838244
Your choices seem to be:
* do a regular copy/paste and insert a new column B in sheet 2.

* do two copy/paste operations

* implement a direct value copy with two VBA statements
0
 
LVL 14

Accepted Solution

by:
Faustulus earned 500 total points
ID: 38846123
Please try this code:-
Option Explicit

Sub TransferData()

    Dim WsT As Worksheet            ' Target sheet
    Dim WsS As Worksheet            ' Source sheet
    Dim C As Long                   ' Source column
    
    Set WsS = Sheets("Sheet1")
    Set WsT = Sheets("Sheet2")
    Application.ScreenUpdating = False
    
    For C = 6 To 2 Step -1         ' insert columns
        WsS.Columns(C).Insert
    Next C
    
    With WsS
        Range(.Columns(1), .Columns(11)).Copy Destination:=WsT.Cells(1, 1)
    End With
    
    For C = 2 To 6                 ' delete blank columns
        WsS.Columns(C).Delete
    Next C
    Application.ScreenUpdating = True
End Sub

Open in new window

I think it should accomplish what you wish to do.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

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

10 Experts available now in Live!

Get 1:1 Help Now