+ Reply to Thread
Results 1 to 5 of 5

Copy column from one sheet to another

Hybrid View

  1. #1
    Registered User
    Join Date
    01-27-2014
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Copy column from one sheet to another

    Hi all,

    I would like to create a macro that copies a column from one sheet ("master") to another ("copied") then clears the data in the "master" sheet. The column that needs to be copied is B20 through B34, and the data that needs to be cleared is B3 through D17. I want the data to be copied to a new column in "copied" each time, starting in column B. I have little to no experience in macro programming, so I don't even know where to begin. Does anyone have any suggestions?

    Thanks,
    avanir151

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy column from one sheet to another

    Sub copymaster()
    
    With Sheets("Master")
    
        .Range("B20:B34").Copy Sheets("copied").Cells(1, Columns.Count).End(xlToLeft).Offset(, 1)
        .Range("B3:D17").ClearContents
         Application.CutCopyMode = 0
    End With
    End Sub
    Last edited by AB33; 01-27-2014 at 06:45 PM.

  3. #3
    Registered User
    Join Date
    01-27-2014
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Copy column from one sheet to another

    AB33 this code copies the data correctly but there is a #REF! error when it puts the numbers on the new sheet. I tried to do a Data Validation so that both of the boxes were formatted to accept a decimal, but it still didn't work. Do you have any suggestions to fix this?

    EDIT: The #REF! error is occurring because the cells I am copying are set equal to formulas. Is there any way to paste special --> values for the cells in this code?

    Thanks
    Last edited by avanir151; 01-28-2014 at 10:19 AM.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy column from one sheet to another

    Sub copymaster()
    
    With Sheets("Master")
    
        .Range("B20:B34").Copy
        Sheets("copied").Cells(1, Columns.Count).End(xlToLeft).Offset(, 1).PasteSpecial xlValues
        .Range("B3:D17").ClearContents
         Application.CutCopyMode = 0
    End With
    End Sub

  5. #5
    Registered User
    Join Date
    01-27-2014
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Copy column from one sheet to another

    Thank you, that was very helpful!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 01-22-2014, 05:36 PM
  2. Replies: 3
    Last Post: 01-30-2013, 04:32 PM
  3. Copy Data from one column in a sheet to another column present in 2nd sheet
    By pan07 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-21-2012, 12:50 AM
  4. Copy column data on one sheet to row or column date on another sheet based on user in
    By soready42012 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-08-2012, 12:03 AM
  5. Replies: 1
    Last Post: 10-30-2009, 10:58 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1