Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can a macro be written that would clear the contents from all yellow cells in
a worksheet? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() For Each cell In Activesheet.UsedRange If cell.Interior.ColorIndex = 6 Then cell.ClearContents End If Next cell -- HTH RP (remove nothere from the email address if mailing direct) "Paul H" wrote in message ... Can a macro be written that would clear the contents from all yellow cells in a worksheet? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I tried inserting the formula you listed. The debug pointed to an erroe in
the ' markjust before your formula. What should i do. 678-256-1968 Thanks "Bob Phillips" wrote: For Each cell In Activesheet.UsedRange If cell.Interior.ColorIndex = 6 Then cell.ClearContents End If Next cell -- HTH RP (remove nothere from the email address if mailing direct) "Paul H" wrote in message ... Can a macro be written that would clear the contents from all yellow cells in a worksheet? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Paul, it could be that you have merged cells in your sheet, if that is the
case, just change one line in Bob's code, like this Sub Clear_Yellow() For Each cell In ActiveSheet.UsedRange If cell.Interior.ColorIndex = 6 Then cell.Formula = "" End If Next cell End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul H" wrote in message ... I tried inserting the formula you listed. The debug pointed to an erroe in the ' markjust before your formula. What should i do. 678-256-1968 Thanks "Bob Phillips" wrote: For Each cell In Activesheet.UsedRange If cell.Interior.ColorIndex = 6 Then cell.ClearContents End If Next cell -- HTH RP (remove nothere from the email address if mailing direct) "Paul H" wrote in message ... Can a macro be written that would clear the contents from all yellow cells in a worksheet? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I tried it and it worked then subsequent clearings didn't work. Additionally
I don't want to clear the formulas just the contents. Paul "Paul B" wrote: Paul, it could be that you have merged cells in your sheet, if that is the case, just change one line in Bob's code, like this Sub Clear_Yellow() For Each cell In ActiveSheet.UsedRange If cell.Interior.ColorIndex = 6 Then cell.Formula = "" End If Next cell End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul H" wrote in message ... I tried inserting the formula you listed. The debug pointed to an erroe in the ' markjust before your formula. What should i do. 678-256-1968 Thanks "Bob Phillips" wrote: For Each cell In Activesheet.UsedRange If cell.Interior.ColorIndex = 6 Then cell.ClearContents End If Next cell -- HTH RP (remove nothere from the email address if mailing direct) "Paul H" wrote in message ... Can a macro be written that would clear the contents from all yellow cells in a worksheet? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Paul, try this one
Sub Clear_Yellow() On Error Resume Next For Each cell In ActiveSheet.UsedRange.SpecialCells(xlCellTypeConst ants, 2) If cell.Interior.ColorIndex = 6 Then cell.Formula = "" End If Next cell End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul H" wrote in message ... I tried it and it worked then subsequent clearings didn't work. Additionally I don't want to clear the formulas just the contents. Paul "Paul B" wrote: Paul, it could be that you have merged cells in your sheet, if that is the case, just change one line in Bob's code, like this Sub Clear_Yellow() For Each cell In ActiveSheet.UsedRange If cell.Interior.ColorIndex = 6 Then cell.Formula = "" End If Next cell End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul H" wrote in message ... I tried inserting the formula you listed. The debug pointed to an erroe in the ' markjust before your formula. What should i do. 678-256-1968 Thanks "Bob Phillips" wrote: For Each cell In Activesheet.UsedRange If cell.Interior.ColorIndex = 6 Then cell.ClearContents End If Next cell -- HTH RP (remove nothere from the email address if mailing direct) "Paul H" wrote in message ... Can a macro be written that would clear the contents from all yellow cells in a worksheet? |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Paul,
Yes...See my answer to your original question. Gary Brown "Paul H" wrote: Can a macro be written that would clear the contents from all yellow cells in a worksheet? |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oh, the heck with it...Yes...
Sub test() Dim cell As Range For Each cell In Selection If cell.Interior.ColorIndex = 6 Then cell.ClearContents End If Next cell End Sub 6 is bright yellow 36 is light yellow or using Range Names... Sub test() Dim cell As Range For Each cell In Range("TEST") If cell.Interior.ColorIndex = 6 Then cell.ClearContents End If Next cell End Sub "Paul H" wrote: Can a macro be written that would clear the contents from all yellow cells in a worksheet? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro for clearing cells | Excel Discussion (Misc queries) | |||
Clearing a cell value after a set time period - Macro?? | Excel Discussion (Misc queries) | |||
Macro for clearing cell contents | Excel Discussion (Misc queries) | |||
Clearing All check boxes using Macro | Excel Discussion (Misc queries) | |||
macro clearing cell content | Excel Programming |