Clear Cells Based On Value Using Replace Excel VBA Macro

Поделиться
HTML-код
  • Опубликовано: 4 дек 2024

Комментарии • 3

  • @nadermounir8228
    @nadermounir8228 9 месяцев назад +1

    Nice video looking forward to your next video 😊

  • @beverlynazareno2029
    @beverlynazareno2029 7 месяцев назад

    Hi, how about if I want to clear values on colored cells? Not the whole row or column but just the highlighted ones. Or if I want to clear the cells based on the words on another cell? Thank you!

    • @ExcelMacroMania
      @ExcelMacroMania  7 месяцев назад

      To clear values in colored cells you need to use the other method (Part2). See the video here: ruclips.net/video/-OAfoPi-eX8/видео.htmlsi=cka8OnIL6kvOi2yz
      That other method loops through target cells and checks for any condition. For example, to clear values for a cell colored yellow you do something like this:
      For Each cel lIn targetRange
      If cell.Interior.Color = vbYellow Then cell.Value = ""
      Next cell
      To clear cells based on words from other cell you can to use Offset. For example, let's say you want to clear cells which have a cell in the same row and next column with the word "DONE":
      For Each cel lIn targetRange
      If cell.Offset(0,1) = "DONE" Then cell.Value = ""
      Next cell