+ Reply to Thread
Results 1 to 4 of 4

Trying(failing) to delete cell contents if...

  1. #1
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Trying(failing) to delete cell contents if...

    Hi all,

    Can anyone tell me why the following code fails?
    I can't see a problem with it, but it just won't run as part of a userform_initialize code.
    I want to check the worksheet "Model", and if a cell in column A is greater than 0 and corresponding cell in Column B is empty/blank/"", then column C should be updated to empty/blank/""
    Any help much appreciated

    Pete

    Please Login or Register  to view this content.
    Pete
    Struggling Solutions Architect

  2. #2
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Trying(failing) to delete cell contents if...

    fixed it... simple logic prevailed in the end, as did the addition of another beer's inspiration...
    Please Login or Register  to view this content.

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Trying(failing) to delete cell contents if...

    Because objects needs SET keyword, but no need to assign the sheet to activesheet when you already have With statement.

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Trying(failing) to delete cell contents if...

    A few qualifiers are missing I think.

    I don't think ActiveSheet = Sheets("Model") does anything.
    Are you trying to activate the 'Model' sheet? If so, use
    Sheets("Model").Activate

    The With statement is not being used here. Should all Cells and Range refer to Sheets("Model")? If so...
    Please Login or Register  to view this content.

+ 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 Rows that contain matching cell contents in column to the contents in cell B1
    By sspatriots in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-23-2015, 05:39 PM
  2. [SOLVED] Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank cell
    By murtaza.khan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-04-2014, 01:11 AM
  3. How do I delete the contents in a cell, every other row?
    By ninj5 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-22-2013, 05:49 PM
  4. [SOLVED] Delete rows failing
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-30-2011, 05:02 PM
  5. Delete cell contents
    By jsomer2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-13-2011, 08:38 AM
  6. Delete cell contents in Code
    By garyi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2011, 12:06 PM
  7. Delete contents of a cell
    By knighttrader in forum Excel General
    Replies: 2
    Last Post: 07-25-2008, 11:59 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