I just want to highlight cell with number. This macro highlights cell with text also.
Sub high()
Dim ws As Worksheet
Dim yourrange As Range
Set ws = ActiveSheet
For Each yourrange In ws.Cells.SpecialCells(xlCellTypeConstants)
yourrange.Interior.Color = 65535
Next yourrange
End Sub
On the Home tab, in the Style group, click the arrow next to Conditional Formatting, and then click Highlight Cells Rules. Select the command you want, such as Between, Equal To Text that Contains, or A Date Occurring. Enter the values you want to use, and then select a format.
Select the range of cells, the table, or the whole sheet that you want to apply conditional formatting to. On the Home tab, click Conditional Formatting. Point to Highlight Cells Rules, and then click Text that Contains. Type the text that you want to highlight, and then click OK.
To select the duplicate values, from the dropdown menu of Conditional Formatting, select Highlight Values and then select Duplicate Values. Choose the formatting you'd want to apply to the duplicate values, and you are done. You may also highlight duplicate values within each column separately.
Select one or more rows and columns Or click on any cell in the column and then press Ctrl + Space. Select the row number to select the entire row. Or click on any cell in the row and then press Shift + Space. To select non-adjacent rows or columns, hold Ctrl and select the row or column numbers.
There are two options for you: with VBA and without WBA:
1) Using VBA
without using loop, thanks to @Siddharth Rout:)
Sub high()
Dim ws As Worksheet
Dim rng As Range
Set ws = ActiveSheet
On Error Resume Next
Set rng = ws.Cells.SpecialCells(xlCellTypeConstants, xlNumbers)
On Error GoTo 0
If Not rng Is Nothing Then rng.Interior.Color = 65535
End Sub
Using loop:
Sub high()
Dim ws As Worksheet
Dim yourrange As Range
Dim rng As Range
Set ws = ActiveSheet
On Error Resume Next
Set rng = ws.Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0
If Not rng Is Nothing Then
For Each yourrange In rng
If IsNumeric(yourrange) Then yourrange.Interior.Color = 65535
Next yourrange
End If
End Sub
2) Without VBA, (thanks to @pnuts):
Go to "Find & Select" menu Item on the Ribbon and select "GoTo Special..":
choose "Constants" and select only "Numbers" and press "OK".
Now, excel highlighted all number cells:
Next step is to fill them with desired color:
Done:)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With