lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi I am trying to understand the code below which highlight blank cells. 2 parts I did not understand
1) what does this line do " Set Dataset = Selection "?
2) what SpecialCells() function does here --> Dataset.SpecialCells(xlCellTypeBlanks).Interior.Color = vbRed
Thank you so much.
source: https://trumpexcel.com/excel-macro-examples/
'This code will highlight all the blank cells in the dataset
Sub HighlightBlankCells()
[FONT="][/FONT][FONT="][/FONT]Dim Dataset as Range
Set Dataset = Selection
Dataset.SpecialCells(xlCellTypeBlanks).Interior.Color = vbRed
End Sub
1) what does this line do " Set Dataset = Selection "?
2) what SpecialCells() function does here --> Dataset.SpecialCells(xlCellTypeBlanks).Interior.Color = vbRed
Thank you so much.
source: https://trumpexcel.com/excel-macro-examples/
'This code will highlight all the blank cells in the dataset
Sub HighlightBlankCells()
[FONT="][/FONT][FONT="][/FONT]Dim Dataset as Range
Set Dataset = Selection
Dataset.SpecialCells(xlCellTypeBlanks).Interior.Color = vbRed
End Sub