+ Reply to Thread
Results 1 to 4 of 4

Clear function not working when copy to a new workbook

  1. #1
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Clear function not working when copy to a new workbook

    Hi,
    I built a macro that takes items url with the help of vlookup and inserts the photos to a cel.
    I would like to copy the new spreadsheet into a new workbook.
    However columns E and F have information that I would like to clear.
    For some reason when information is copied into the new workbook the function that clears E and F is not clearing.
    Please advice
    I am also attaching the Excel worksheet with the macro in it.
    I am also adding only the problematic code in the code tags(hopefully I inputted the code correctly a long time passed since I posted a VBA question)

    Thank You

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Clear function not working when copy to a new workbook

    Relying on activate and present focus is not very secure.

    Try using the below code:

    replace

    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.
    If you like my contribution click the star icon!

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Clear function not working when copy to a new workbook

    When you have Activesheet.copy
    A workbook is already added
    Your code should possibly look like.
    Please Login or Register  to view this content.
    Last edited by davesexcel; 12-22-2014 at 07:24 AM.

  4. #4
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Clear function not working when copy to a new workbook

    Thank you.
    That works the issue was when ActiveSheet.Copy it created a new book.

+ 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] Help! Copy row from one workbook and paste into last row of another workbook not working
    By Jo2710 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2014, 05:24 PM
  2. [SOLVED] copy range from another workbook not working
    By jed38 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2013, 03:09 PM
  3. Code to Copy a Module from on Workbook to another not working?
    By JungleJme in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2013, 10:48 AM
  4. Replies: 0
    Last Post: 03-04-2013, 01:15 PM
  5. Copy and clear Comments from once woork book to other workbook
    By dhrumilp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-12-2013, 06:05 PM

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