PC Review


Reply
Thread Tools Rate Thread

Delete values colored cells

 
 
marc747@excite.com
Guest
Posts: n/a
 
      5th Aug 2008
Hi,
I am trying to make a macro that when I run it, it Deletes the values
of the cells that are yellow in interior color,
I appreciate for any help! Thanks!
 
Reply With Quote
 
 
 
 
marcus
Guest
Posts: n/a
 
      5th Aug 2008
Hi Mark

Assuming your data is in Column A and starts in Row 2, this should
sort you out. Change column to suit if this is not the case.

Take care

Marcus

Sub DeleteYellow()

Dim Lw As Long
Application.ScreenUpdating = False
Lw = Range("A" & Rows.Count).End(xlUp).Row

'Change 2 to appropriate number
For i = Lw To 2 Step -1
If Range("A" & i).Interior.ColorIndex = 6 Then
Range("A" & i).EntireRow.Delete
End If
Next i

End Sub
 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      5th Aug 2008
Have a go with this (note it also clears the yellow in cells)

Sub DelYellows()
Dim lClr As Long
Dim rng As Range, c As Range

If TypeName(Selection) <> "Range" Then
MsgBox "Select cells"
Exit Sub
End If

Set rng = Intersect(ActiveSheet.UsedRange, Selection)

If rng Is Nothing Then
' selection outside the usedrange
Exit Sub
End If

If rng.Count > 100000 Then
If MsgBox(rng.Count & " cells to process, might take a while", _
vbOKCancel) <> vbOK Then
Exit Sub
End If
End If

For Each c In rng
If c.Interior.Color = vbYellow Then
c.Interior.ColorIndex = xlNone
c.ClearContents
End If
Next

End Sub

Regards,
Peter T

<(E-Mail Removed)> wrote in message
news:349fa44c-399f-4fbb-9e94-(E-Mail Removed)...
> Hi,
> I am trying to make a macro that when I run it, it Deletes the values
> of the cells that are yellow in interior color,
> I appreciate for any help! Thanks!



 
Reply With Quote
 
marcus
Guest
Posts: n/a
 
      5th Aug 2008
Hi Mark

I read your post incorrectly. This removes the values of those cells
which are yellow in Column A. Change the column to suit.

Marcus

Sub DeleteYellow()

Dim Lw As Long
Application.ScreenUpdating = False
Lw = Range("A" & Rows.Count).End(xlUp).Row

For i = Lw To 2 Step -1
If Range("A" & i).Interior.ColorIndex = 6 Then
Range("A" & i).Value = ""
End If
Next i

End Sub

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Function to Sum colored cells values not working K Microsoft Excel Programming 4 10th Jul 2010 01:00 PM
I need to delete the values in some cells, Skip Microsoft Excel Worksheet Functions 5 6th Nov 2009 07:26 PM
delete values in cells =?Utf-8?B?Skg=?= Microsoft Excel Programming 4 31st Jan 2005 12:53 PM
Cell right next to colored cells is automatically colored on entering a value Johan De Schutter Microsoft Excel Misc 6 12th Sep 2003 05:31 PM
Cell right next to colored cells is automatically colored on entering a value Johan De Schutter Microsoft Excel Programming 6 12th Sep 2003 05:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:12 PM.