Here I will insert different size datatable into sheet1 & sheet2. I will
use checkboxes to compare data.
I want that when I clicked on CheckBox1 then It will compare data from
sheet1 by sheet2 & highlight by yellow color.
VBA ColorIndex Code List...
VBA Codes thats are used in this tutorials...
VBA ColorIndex Examples
Set Cell Background Color
Range("A1").Interior.ColorIndex = 6
|
Set Cell Font Color
Range("A1").Font.ColorIndex = 5
|
Set Cell Borders Color
Range("A1").Borders.ColorIndex = 5
|
Get Cell Background ColorIndex
Dim col as integer
col = Range("A1").Interior.ColorIndex
|
Set a Cell Background Color to Another Cell’s Color
Range("A1").Interior.ColorIndex = Range("B1").Interior.ColorIndex
|
Codes Discussion :
declare two variables to set the worsheets
Declare a variable as long to find out last row number. Here I declared the
variables by x and used it to find out the last non-blank row number based on
Column A
Declare another variable to input column number whose cells value will be
compared
use a loop function with a variables to check each and every cell value
Now use countif function to to find out duplicate values. and after finding
duplicate value then change the background color for those cell only which are
duplicate..
VBA codes for CheckBox2.....
VBA codes for CheckBox3..
VBA Codes for CheckBox4 Where I compare all data for sheet1 with sheet2's
particular cell values..
No comments:
Post a Comment