+ Reply to Thread
Results 1 to 10 of 10

Copy a column and paste to a different column in a different sheet

  1. #1
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    110

    Exclamation Copy a column and paste to a different column in a different sheet

    I tried using the code below to export from another sheet to a different column in a another sheet and getting an error:

    my full code is: (the red code lines will be the ones I am getting the error from)
    Please Login or Register  to view this content.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Copy a column and paste to a different column in a different sheet

    What is the error message? and which specific line is highlighted when you click debug?

  3. #3
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    110

    Re: Copy a column and paste to a different column in a different sheet

    I will be getting an image of the error and post as soon as possible
    Last edited by smartbuyer; 01-17-2016 at 09:19 PM. Reason: Incorrect info stated

  4. #4
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    110

    Re: Copy a column and paste to a different column in a different sheet

    here are the images of the error
    Capture2.PNGCapture1.PNG

  5. #5
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Copy a column and paste to a different column in a different sheet

    The images did not come through, but maybe this will help. In this:
    Set found = wsProc.Columns(1).Find(cel, lookat:=xlWhole)
    line of code, change to
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    110

    Re: Copy a column and paste to a different column in a different sheet

    tried to attached the images to a spreadsheet. see errors.xlsx

  7. #7
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    110

    Re: Copy a column and paste to a different column in a different sheet

    t
    Quote Originally Posted by JLGWhiz View Post
    The images did not come through, but maybe this will help. In this:

    line of code, change to
    Please Login or Register  to view this content.
    tried updating the line of code as above, still getting the error.

  8. #8
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Copy a column and paste to a different column in a different sheet

    Quote Originally Posted by smartbuyer View Post
    tried to attached the images to a spreadsheet. see Attachment 441209
    Since every variable in that line had previously been used without error, you need to use your mouse pointer while in debug mode and hover over each variable to see which one lost its value. The defective variable should show "Nothing" as a value in the tool tips box while the mouse pointer hovers over it. Just looking at the code, I cannot readily see any reason for an error, but sometimes blank cells in a column or row can cause a change in a variable value. This is especially true with a Find statement. Since you are using the find statement while in filter mode, it could be that a found cell is not visible and is causing the problem. But that is just a guess.
    Last edited by JLGWhiz; 01-18-2016 at 05:46 PM.

  9. #9
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    110

    Re: Copy a column and paste to a different column in a different sheet

    Quote Originally Posted by JLGWhiz View Post
    Since every variable in that line had previously been used without error, you need to use your mouse pointer while in debug mode and hover over each variable to see which one lost its value. The defective variable should show "Nothing" as a value in the tool tips box while the mouse pointer hovers over it. Just looking at the code, I cannot readily see any reason for an error, but sometimes blank cells in a column or row can cause a change in a variable value. This is especially true with a Find statement. Since you are using the find statement while in filter mode, it could be that a found cell is not visible and is causing the problem. But that is just a guess.
    I will look into it, there might be a need for me to change the entire code to import from a specific column of one file to a specific column on another based on criteria.

    Appreciate you looking into this JLGWhiz.

  10. #10
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Copy a column and paste to a different column in a different sheet

    Quote Originally Posted by smartbuyer View Post
    I will look into it, there might be a need for me to change the entire code to import from a specific column of one file to a specific column on another based on criteria.

    Appreciate you looking into this JLGWhiz.
    Glad to assist, hope you find the problem.
    Regards, JLG

+ 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. [SOLVED] copy till last used row of a column and paste it into another column of another sheet
    By yogi_himalayan in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-25-2015, 03:27 AM
  2. Replies: 1
    Last Post: 05-30-2015, 04:38 PM
  3. [SOLVED] Macro to copy and paste only unique values from one column to another column in same sheet
    By Manish_Gupta in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-19-2014, 05:44 AM
  4. Copy column and paste into same sheet
    By Rose0402 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-26-2013, 06:04 PM
  5. Vba - find next empty column, insert column, copy paste values & copy paste formulas
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2012, 12:43 PM
  6. Copy Column in Sheet 1 and Paste into First Available Column on Sheet 2
    By johndoh453 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2011, 07:42 AM
  7. Copy Data from Column and Paste to Next Blank Column on 2nd Sheet
    By adammark in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-19-2010, 11:15 AM

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