08-11-22 10:02 AM
08-11-22 12:46 PM
Dim range As Object
Dim currentCell As Object
Try
range = GetWorkbook(handle,Nothing).ActiveSheet.Range(startcell,endcell)
For Each currentCell In range
currentCell.Interior.Color = RGB(color_R, color_G, color_B)
Next currentCell
Catch ex As Exception
Finally
range = Nothing
End Try
Make sure to save your changes.
The above will give you a general action you can use to the set the background color of cells in a specific range. The color is based on RGB (Red, Green, Blue) values, so to set a cells background to red you would set ColorValue-R = 255 and the others to 0. Hopefully that makes sense.
This action doesn't account for the value criteria you mentioned though. You could either extend the code above the include a check of the cells value before changing the color, or you could just use Find action of the VBO to find all cells that have a value of Yes (or No) and use then iterate over the resulting Collection and call this new action on each of those cells.
Cheers,
08-11-22 03:48 PM
08-11-22 04:06 PM
08-11-22 06:29 PM
a week ago
Mr. Ewilson thanks a lot, I've tried this method, and it works perfectly. However, I'm wondering if any actions have been developed in the newer versions of MS Excel VBO? in 2025
a week ago
After conducting some research, it appears that there is an enhanced version of the MS Excel VBO. Instead of using the standard one, you should use the MS Excel VBO Extended, which you can download from the following link: MS Excel VBO Extended.