Solved

MS Excel - Selected Copy Paste

Posted on 2013-01-30
2
222 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

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

743 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

14 Experts available now in Live!

Get 1:1 Help Now