+ Reply to Thread
Results 1 to 9 of 9

Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank cell

  1. #1
    Registered User
    Join Date
    12-10-2012
    Location
    Canada
    MS-Off Ver
    Microsoft Excel: Mac 2011 & Microsoft Excel 2010
    Posts
    13

    Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank cell

    I struggling to write this simple macro.

    I have a data set and I want the macro to delete the contents of the corresponding cell on the same row in 23rd column if the cell in range is a non-blank cell. The code I am using is

    Please Login or Register  to view this content.
    I would highly appreciate if someone can help.
    Thanks... Murtaza

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank c

    Several ways... is column B filled with constants? Manually typed entries, and some of the cells are empty?
    Then this would do it:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank c

    @JB: I might be reading it wrong but I thought he wanted to delete if the cell was non-blank.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    12-10-2012
    Location
    Canada
    MS-Off Ver
    Microsoft Excel: Mac 2011 & Microsoft Excel 2010
    Posts
    13

    Re: Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank c

    Shall Ii replace it with
    Please Login or Register  to view this content.
    OR

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-10-2012
    Location
    Canada
    MS-Off Ver
    Microsoft Excel: Mac 2011 & Microsoft Excel 2010
    Posts
    13

    Re: Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank c

    Yup... That's right TMShucks....

    I want to delete the contents of the corresponding cell if the cell in range is a non-blank cell or in other words the cell in range has any value.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank c

    Ok, tiny tweak:

    Please Login or Register  to view this content.
    Are the cells filled with constants? Manually entered values, not formulas?


    My code snippet above is a suggested replacement for ALL of your code presented, not one line of it.
    Last edited by JBeaucaire; 03-03-2014 at 08:59 PM.

  7. #7
    Registered User
    Join Date
    12-10-2012
    Location
    Canada
    MS-Off Ver
    Microsoft Excel: Mac 2011 & Microsoft Excel 2010
    Posts
    13

    Re: Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank c

    Thank you very much JBeaucaire.
    It worked perfectly fine.

    Appreciate all your support.
    Best regards,

    Murtaza.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank c

    I've marked this thread as SOLVED for you.

    Next time, select Thread Tools from the links above to mark a thread as SOLVED. Thanks.

  9. #9
    Registered User
    Join Date
    12-10-2012
    Location
    Canada
    MS-Off Ver
    Microsoft Excel: Mac 2011 & Microsoft Excel 2010
    Posts
    13

    Re: Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank c

    Thank you JBeaucaire... I've noted it for compliance in future.
    Murtaza

+ 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. Delete cell contents if another cell is blank
    By MikeWaring in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2015, 04:45 PM
  2. Delete Cell Contents If Another Cell Is Blank - Excel
    By willempotgieter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-03-2014, 12:53 PM
  3. [SOLVED] Macro to delete certain contents of a cell
    By SpyderPB6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2012, 07:16 PM
  4. Replies: 1
    Last Post: 05-10-2012, 04:58 PM
  5. Macro to delete cell contents in every other column
    By rhudgins in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-01-2010, 12:29 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