• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Delete non formated values

BryanH

New Member
I have another issue to resolve, as per attached I need to automate a process that removes all figures that do not have color fill in the cell (it is not conditional format)

Table 1 I have
Table 2 is what the result needs to be

This table has 2427 row and 26 columns

any help will be appreciated in kind

Thanks!
 

Attachments

Hi Bryan,

I've tried this code and runs fine:
Code:
Sub Clear_contents()

Range("C2:I17").Select 'change as per your requirement
For Each cell In Selection
    If cell.Interior.Color = vbWhite Then
    cell.Clear
    End If
Next

End Sub

You just need to change cell color to white for the cells need to be cleared.

code copy from

Regards,
 
Hi!
Another Code (Similar to @Khalid NGO):

PHP:
Sub TestClear()
    Dim C As Range, t!
    t = Timer: Application.ScreenUpdating = 0
    For Each C In Range("C3:AB2430") 'Change to your Range
        If C.Interior.Color <> RGB(253, 233, 217) Then C.Clear
    Next C
    Set C = Nothing: Application.ScreenUpdating = 1
    MsgBox "Done! Time taken: " & Format(Timer - t, "0.00 seg.")
End Sub

The time taken with the data size you post was around 3,3 seg. (in my computer). Please Comment! Blessings!
 
Back
Top