+ Reply to Thread
Results 1 to 9 of 9

Macro, Clear function in a row that has #VALUE!

Hybrid View

  1. #1
    Registered User
    Join Date
    02-17-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Macro, Clear function in a row that has #VALUE!

    I've been trying to wrap my brain around this and just can't figure it out.!.

    Col, G:1 - G:100

    I want to have a macro that will clear all contents (function) of these cells that have #VALUE!...

    pls help!
    Last edited by hzppby; 03-20-2012 at 01:41 AM.

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Macro, Clear function in a row that has #VALUE!

    Hi hzppby,

    If you have formulas in G1 to G100 and #value is appearing as some of the results, would suggest you to use error handlers function.. i.e., =if(iserror(formula),"",formula)

    Post the sample file if you face any issues. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Registered User
    Join Date
    02-17-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro, Clear function in a row that has #VALUE!

    I want to have a macro go threw that row and clear everything in those cells returning #value
    G column

    when i add what you have just returns false.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Macro, Clear function in a row that has #VALUE!

    Hi hzppby,

    Try this while on the 'players' tab:

    Option Explicit
    Sub Macro1()
    
        Dim rngCell As Range
        
        Application.ScreenUpdating = False
        
        For Each rngCell In Range("G1", Range("G" & Rows.Count).End(xlUp))
            If IsError(rngCell) = True Then
                rngCell.ClearContents
            End If
        Next rngCell
        
        Application.ScreenUpdating = True
    
    End Sub
    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Registered User
    Join Date
    02-17-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro, Clear function in a row that has #VALUE!

    Worked like a charm! thanks


    Quote Originally Posted by Trebor76 View Post
    Hi hzppby,

    Try this while on the 'players' tab:

    Option Explicit
    Sub Macro1()
    
        Dim rngCell As Range
        
        Application.ScreenUpdating = False
        
        For Each rngCell In Range("G1", Range("G" & Rows.Count).End(xlUp))
            If IsError(rngCell) = True Then
                rngCell.ClearContents
            End If
        Next rngCell
        
        Application.ScreenUpdating = True
    
    End Sub
    HTH

    Robert

  6. #6
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Macro, Clear function in a row that has #VALUE!

    Hi hzppby,

    See the formula applied in yellow cell in the attached file.

    Also, I am not convinced with the formula you have in that column, which can be improved if you can provide the logic behind. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-17-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro, Clear function in a row that has #VALUE!

    Well i need to delete the function not being used, because one of the macros starts at the G1 and does a Shift+end+down arrow. and its still going to the end of col g100.
    this is why i need a macro to delete functions not being used in this col.

  8. #8
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Macro, Clear function in a row that has #VALUE!

    Ok.. in that case check the solution provided by Robert in post #5.

    cheers

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  9. #9
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Macro, Clear function in a row that has #VALUE!

    Glad to hear it!! Make sure to mark the thread as solved when you get a chance.
    Last edited by Trebor76; 03-20-2012 at 08:34 PM.

+ 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