S sambit Member Apr 9, 2022 #1 Sir, please help to resolve the below mention issue. How to delete data which is not highlight ? data range F3:V16 Example file attached for your reference. Attachments EXAMPLE - .xlsx 12.1 KB · Views: 9
Sir, please help to resolve the below mention issue. How to delete data which is not highlight ? data range F3:V16 Example file attached for your reference.
Belleke Well-Known Member Apr 9, 2022 #2 Like this? Code: Sub clearrng() For Each c In ActiveSheet.Range("F3:V16") If c.Interior.ColorIndex = xlNone Then c.ClearContents Next c End Sub See example Attachments EXAMPLE - .xlsm 19.2 KB · Views: 5
Like this? Code: Sub clearrng() For Each c In ActiveSheet.Range("F3:V16") If c.Interior.ColorIndex = xlNone Then c.ClearContents Next c End Sub See example
S sambit Member Apr 9, 2022 #3 Belleke Sir, Thank you very much for resolve the issue. is it possible without VBA ?
Belleke Well-Known Member Apr 9, 2022 #4 is it possible without VBA ? Click to expand... https://www.excelhow.net/deleting-non-highlighted-cells.html
is it possible without VBA ? Click to expand... https://www.excelhow.net/deleting-non-highlighted-cells.html
B bosco_yip Excel Ninja Apr 9, 2022 #5 Another formula solution is to mask the unwanted data with white color, so that the data will not be lost. 1] To create Range Name >> Select F3:V16 >> Define name >> Name : CellHasColor Refers to : =GET.CELL(63,INDIRECT("rc",0)) OK Then 2] Select F3:V16 >> Format Cell >> Font >> choose: "White" color >> OK 3] Select F3:V16 >> Conditional Formatting >> New Rule >> Use a formula... >> In the Rule box, enter : =CellHasColor Click "Format" >> Font >> Choose "Black" color OK 4] When you fill new color to other cells, the cells will auto return the original content letter. Remark : GetCell is a Macro 4 function, file need to be saved in xlsm type Excel Macro-Enabled Worksheet Attachments MaskingTextColor.xlsm 15.9 KB · Views: 1 Last edited: Apr 9, 2022
Another formula solution is to mask the unwanted data with white color, so that the data will not be lost. 1] To create Range Name >> Select F3:V16 >> Define name >> Name : CellHasColor Refers to : =GET.CELL(63,INDIRECT("rc",0)) OK Then 2] Select F3:V16 >> Format Cell >> Font >> choose: "White" color >> OK 3] Select F3:V16 >> Conditional Formatting >> New Rule >> Use a formula... >> In the Rule box, enter : =CellHasColor Click "Format" >> Font >> Choose "Black" color OK 4] When you fill new color to other cells, the cells will auto return the original content letter. Remark : GetCell is a Macro 4 function, file need to be saved in xlsm type Excel Macro-Enabled Worksheet
Belleke Well-Known Member Apr 9, 2022 #6 I don't get it with 2 linses of code,your problem is solved,why not VBA?