+ Reply to Thread
Results 1 to 17 of 17

macro to clear values fom 0 (zero) to 0.01

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,888

    macro to clear values fom 0 (zero) to 0.01

    I have tried to write code to clear values from 0 to 0.01 in Col F from row 2 onwards

    The macro clearing all data in the same row as where 0 to 0.01 in in Col F


    Please Login or Register  to view this content.

    It would be appreciated if someone could amend my code
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,097

    Re: macro to clear values fom 0 (zero) to 0.01

    See next code
    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this !


    According to your attachment a beginner starter demonstration :

    PHP Code: 
    Sub Demo1()
             
    Dim Rg As Range
        
    For Each Rg In Sheet1.UsedRange.Columns(6).Cells
              
    If Rg.Text <= 0.01 Then Rg.ClearContents
        Next
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 01-02-2020 at 11:48 AM. Reason: new idea !

  4. #4
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,888

    Re: Hi ! Try this !

    Thanks for the help Marc. I made one small change


    Please Login or Register  to view this content.

  5. #5
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,034

    Re: macro to clear values fom 0 (zero) to 0.01

    Please Login or Register  to view this content.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  6. #6
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,888

    Re: macro to clear values fom 0 (zero) to 0.01

    Hi PCI

    Thanks for the help. I only want to clear values in Col F from row2 where the values range from 0 to 0.01

    Your code clear the values in Columns A:F where 0 to 0.01 appears in Col F

    I have attached the file after running your code

  7. #7
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,097

    Re: macro to clear values fom 0 (zero) to 0.01

    Your code clear the values in Columns A:F where 0 to 0.01 appears in Col F
    Yes because your original was doing like that and perhaps was it the specifications.
    But now you have a lot to play with ...!

  8. #8
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,034

    Re: macro to clear values fom 0 (zero) to 0.01

    Thanks for the help Marc. I made one small change
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Does exactly the same...With your info...

    PS...One should avoid sheet loops as much as possible....Filtering is just as effective if not more...as per post 5
    Last edited by Sintek; 01-02-2020 at 12:53 PM.

  9. #9
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,888

    Re: macro to clear values fom 0 (zero) to 0.01

    Thanks for your input Sintek

  10. #10
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,034

    Re: macro to clear values fom 0 (zero) to 0.01

    I notice, from most of your other posts that you always opt for looping solutions...Any reason why you prefer loops over Filtering...

  11. #11
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,097

    Re: macro to clear values fom 0 (zero) to 0.01

    Any reason why you prefer loops over Filtering...
    Perhaps more simple to prepare and certainly the first reflex ... a new target for 2020

  12. #12
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,097

    Re: macro to clear values fom 0 (zero) to 0.01

    For the fun a remake with filter
    Please Login or Register  to view this content.

  13. #13
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,034

    Re: macro to clear values fom 0 (zero) to 0.01

    For the fun a remake with filter
    Too late...see post 5

  14. #14
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,888

    Re: macro to clear values fom 0 (zero) to 0.01

    Thanks for the update with Autofilter

  15. #15
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,888

    Re: macro to clear values fom 0 (zero) to 0.01

    Hi Sintek

    The reason why I use looping over filtering is that I am more familiar with this, but will start use autofiltering as much quicker

  16. #16
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,034

    Re: macro to clear values fom 0 (zero) to 0.01

    Understood...tx for clarification...Enjoy your journey...Right platform for learning...

  17. #17
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,097

    Re: macro to clear values fom 0 (zero) to 0.01

    Too late...see post 5
    Perhaps not, when already exist autofilter with selection ...!

+ 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. Replies: 1
    Last Post: 06-21-2013, 04:05 AM
  2. Help with macro to merge/clear duplicate values and leave unique
    By Jharris360 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-18-2012, 11:38 AM
  3. Macro to average imported data, cut, paste, clear values etc
    By mryals in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2011, 02:59 PM
  4. Replies: 4
    Last Post: 04-01-2009, 06:15 PM
  5. [SOLVED] HOW DO I PROTECT VALUES WHEN CREATING CLEAR CONTENTS MACRO?
    By the holster in forum Excel General
    Replies: 1
    Last Post: 02-20-2006, 02:40 PM
  6. Macro to clear combo box values
    By Carpie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-09-2005, 02:05 PM
  7. Clear values
    By Rene' in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-04-2005, 01:06 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