Adjust value of a cell based on the formatting of another using VBA

Mr2017

Well-known Member
Joined
Nov 28, 2016
Messages
644
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi

Simple question about VBA.

I have two sheets - Sheet 1 and Sheet 2.

Sheet 1 has the values 1, 2, and 3 in cells A1, A2, and A3, respectively.

Sheet 1 also has the values 4, 5, and 6 in cells B1, B2, and B3, respectively.

Cells A1 and B3 in Sheet 1 are highlighted in yellow. So Sheet 1 looks like this:

1​
4​
2​
5​
3​
6​

Sheet 2 has the number 0 in cells A1, A2, A3, B1, B2, and B3. Like this:



0​
0​
0​
0​
0​
0​




Question:

Is it possible to get VBA to adjust the values of cells in Sheet 2 based ONLY on the values of the HIGHLIGHTED cells in Sheet 1?

ie the values in the cells in Sheet 2 would become 1 in cell A1 and 6 in cell B3, because those cells are highlighted yellow in Sheet 1? And the formatting would also change so that the cells that have changed in Sheet 2 also become yellow?

Please let me know if you'd like me to clarify the question.

Thanks
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,214,848
Messages
6,121,914
Members
449,054
Latest member
luca142

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top