How to clear all "no fill" cells over 2000+ columns (~75 rows deep) VBA

timeisanelephant77

New Member
Joined
Sep 29, 2020
Messages
2
Office Version
  1. 365
Platform
  1. MacOS
Hello PROS!
I have a file that had a description column for products that did not match up with the style categories of the stock#'s identified. I took the description column from the original file, copied it, and pasted it in a new doc, applied "text to column" to separate out all the keywords and then applied COPY/PASTE/TRANSLATE to make the rows of data into columns. The amount of rows was over 2000 ... which now has become 2000+ columns. I conditionally formatted the data to highlight Birthstones only and applied all the necessary rules. Now I have 2000+ columns with highlighted cells and "no-fill" cells (with data) that need to be sorted and/or segregated out. I do believe I need to achieve this in VBA, and I have tried ... but failed again and again thanks to my lack of experience and knowledge with VBA.

HOW do I either:
1. Delete/Clear Contents of ALL "NO FILL" cells in VBA across 2000+ columns
2. Move all "highlighted" cells to the top so I can manually delete everything else (in VBA)

I hope I can find help on this. Client gave us a terribly mixed up data file and I'm trying to learn if it is fixable ... or if I have to wait for a new file to clean up again.

THANK YOU!

See screenshot example: (here is just a small snapshot of the 2000+ columns I now have.):
Screen Shot 2020-09-29 at 11.04.46 AM.png
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try

VBA Code:
Sub TidyUp()
Dim lastC As Long, lastR As Long, c As Long, r As Long, cel As Range, ws As Worksheet
Set ws = ActiveSheet
Set cel = Range(Split(ws.UsedRange.Address, ":")(1))
lastC = cel.Column: lastR = cel.Row
Application.ScreenUpdating = False: Application.CutCopyMode = False
    
For r = lastR To 2 Step -1
    For c = 1 To lastC
        Set cel = ws.Cells(r, c)
        If cel.Interior.ColorIndex = -4142 Then cel.Delete Shift:=xlUp
    Next c
Next r

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,139
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top