+ Reply to Thread
Results 1 to 3 of 3

Code to clear contents of specific cells based upon if key exists in other sheets

  1. #1
    Registered User
    Join Date
    03-29-2010
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    21

    Code to clear contents of specific cells based upon if key exists in other sheets

    Hello. I'm trying to modify a piece of code to suit my own purposes, but just can't get it to work properly.

    Basically, I have 3 worksheets in a workbook. I want VBA code to run in 1 of the worksheets and clear the contents of the row (not delete entire rows) from B to to AP if the key in column A exists in either of the two other worksheets.

    The equivalent Excel formula which identifies this properly for me is: =IF(COUNTIF(Weekly!A:A,A2)>0,TRUE,IF(COUNTIF(Daily!D:D,A2)>0,TRUE))

    So I want to somehow use the formula above in place of the "ABC"/"DEF" formula in the code below, and also replace the "ActiveSheet.Rows(x).Delete" with a command to just clear the contents from column B to AP.

    ALL help appreciated !!!

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    03-29-2010
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    21

    Re: Code to clear contents of specific cells based upon if key exists in other sheets

    Anyone please? Perhaps this variant would work better .. but still can't get it to work for me .. can't understand how to format the countif in a VBA...

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-29-2010
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    21

    Re: Code to clear contents of specific cells based upon if key exists in other sheets

    Also - just to reclarify, where the if statement is true, I want only the contents of the row from Column B to Column AP to be cleared ... thank you...!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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