["VBA"] >return a value from an “ADJACENT” formatting color cell

montecarlo2012

Well-known Member
Joined
Jan 26, 2011
Messages
984
Office Version
  1. 2010
Platform
  1. Windows
I am trying to figure out if there is a “VBA” way I can return a value from an “ADJACENT” formatting color cell.
All the place headers are adjacent to yesno headers.

Column K is a place value, column L is the formatting color values
Column N is a place value, column O is the formatting color values
Column Q is a place value, column R is the formatting color values
Column T is a place value, column U is the formatting color values

I’m looking for populate in sheet 2 the values on the place columns like this

This is an image of what I am trying to do:

1598027361822.png


I’m looking to populate in sheet 2 the values on the Label “place”, like this:

From Column K is a place value, column L is the formatting color values, I populate sheet2(“B2:G2”) with 1.10.11.17.30
Column N is a place value, column O is the formatting color values are populate (“B3:G3”) with 2.3.10.15.30 and so on

1598027470600.png

<tbody>
K​
L​
M​
N​
O​
P​
Q​
R​
S​
T​
U​
V​
W​
X​
Y​
Z​
AA​
AB​
AC​
AD​
AE​
place​

yesno​
RANK​
place​

yesno​
RANK​
place​

yesno​
RANK​
place​

yesno​
RANK​
place​

yesno​
RANK​
place​

yesno​
RANK​
place​

yesno​
RANK​
1​
42​
2​
1​
17​
2​
1​
24​
2​
1​
10​
2​
1​
24​
3​
1​
24​
3​
1​
24​
2​
2​
2​
1​
2​
34​
2​
2​
3​
1​
2​
24​
2​
2​
45​
3​
2​
45​
3​
2​
26​
2​
3​
3​
1​
3​
42​
2​
3​
10​
1​
3​
45​
2​
3​
21​
2​
3​
10​
2​
3​
45​
2​
4​
4​
1​
4​
3​
1​
4​
13​
1​
4​
17​
1​
4​
33​
2​
4​
26​
2​
4​
6​
1​
5​
6​
1​
5​
10​
1​
5​
17​
1​
5​
21​
1​
5​
48​
2​
5​
30​
2​
5​
10​
1​
6​
13​
1​
6​
13​
1​
6​
21​
1​
6​
22​
1​
6​
52​
2​
6​
41​
2​
6​
21​
1​
7​
17​
1​
7​
22​
1​
7​
22​
1​
7​
26​
1​
7​
10​
1​
7​
21​
1​
7​
28​
1​
8​
24​
1​
8​
24​
1​
8​
32​
1​
8​
30​
1​
8​
26​
1​
8​
33​
1​
8​
30​
1​
9​
31​
1​
9​
31​
1​
9​
33​
1​
9​
33​
1​
9​
30​
1​
9​
48​
1​
9​
33​
1​
10​
32​
1​
10​
32​
1​
10​
34​
1​
10​
34​
1​
10​
41​
1​
10​
52​
1​
10​
35​
1​
11​
34​
1​
11​
37​
1​
11​
41​
1​
11​
41​
1​
11​
1​
0​
11​
1​
0​
11​
41​
1​
12​
37​
1​
12​
41​
1​
12​
42​
1​
12​
42​
1​
12​
2​
0​
12​
2​
0​
12​
43​
1​
13​
41​
1​
13​
43​
1​
13​
43​
1​
13​
43​
1​
13​
3​
0​
13​
3​
0​
13​
48​
1​
14​
43​
1​
14​
45​
1​
14​
45​
1​
14​
48​
1​
14​
4​
0​
14​
4​
0​
14​
51​
1​
15​
45​
1​
15​
53​
1​
15​
48​
1​
15​
52​
1​
15​
5​
0​
15​
5​
0​
15​
52​
1​
16​
51​
1​
16​
1​
0​
16​
52​
1​
16​
1​
0​
16​
6​
0​
16​
6​
0​
16​
1​
0​
17​
53​
1​
17​
2​
0​
17​
53​
1​
17​
2​
0​
17​
7​
0​
17​
7​
0​
17​
2​
0​
18​
1​
0​
18​
4​
0​
18​
1​
0​
18​
3​
0​
18​
8​
0​
18​
8​
0​
18​
3​
0​
19​
5​
0​
19​
5​
0​
19​
2​
0​
19​
4​
0​
19​
9​
0​
19​
9​
0​
19​
4​
0​
20​
7​
0​
20​
6​
0​
20​
4​
0​
20​
5​
0​
20​
11​
0​
20​
11​
0​
20​
5​
0​
21​
8​
0​
21​
7​
0​
21​
5​
0​
21​
6​
0​
21​
12​
0​
21​
12​
0​
21​
7​
0​
22​
9​
0​
22​
8​
0​
22​
6​
0​
22​
7​
0​
22​
13​
0​
22​
13​
0​
22​
8​
0​
23​
10​
0​
23​
9​
0​
23​
7​
0​
23​
8​
0​
23​
14​
0​
23​
14​
0​
23​
9​
0​
24​
11​
0​
24​
11​
0​
24​
8​
0​
24​
9​
0​
24​
15​
0​
24​
15​
0​
24​
11​
0​
25​
12​
0​
25​
12​
0​
25​
9​
0​
25​
11​
0​
25​
16​
0​
25​
16​
0​
25​
12​
0​
26​
14​
0​
26​
14​
0​
26​
11​
0​
26​
12​
0​
26​
17​
0​
26​
17​
0​
26​
13​
0​
27​
15​
0​
27​
15​
0​
27​
12​
0​
27​
13​
0​
27​
18​
0​
27​
18​
0​
27​
14​
0​
28​
16​
0​
28​
16​
0​
28​
14​
0​
28​
14​
0​
28​
19​
0​
28​
19​
0​
28​
15​
0​
29​
18​
0​
29​
18​
0​
29​
15​
0​
29​
15​
0​
29​
20​
0​
29​
20​
0​
29​
16​
0​
30​
19​
0​
30​
19​
0​
30​
16​
0​
30​
16​
0​
30​
22​
0​
30​
22​
0​
30​
17​
0​
</tbody>
after I search in this forum for the word "adjacent", among the 210 post, I didn't found my case, but I saw like the concept in a code, again this is illustration ONLY

VBA Code:
Sub sh1_to_sh2()
Dim Cl As Range
For Each Cl In Range("K2", Range("K" & Rows.Count).End(xlUp))
If Cl.DisplayFormat.Interior.Color = vbYellow Then

Populate sheet 2(“B2:G2”)
Populate sheet 2(“B3:G3”)

Etc.etc.
End If
Next Cl
End Sub
 
I'm getting extra information in one side, you can see what I am talking about.
on B:G the results are correct, but on H:L there are something else.
1598038513020.png
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
That would suggest that some of the cells have a background colour, possibly white.
What colour are you applying via the CF?
 
Upvote 0
Yes, it was, but now I delete couple columns with white, now everything is automatic, black, even I delete the borders format, and still.
 
Upvote 0
my entire workbook you can see in this address
 
Upvote 0
You need to mark it as shared & post the link.
 
Upvote 0
That is still asking me to log-in, you need to mark it for sharing & then post the link it gives you.
 
Upvote 0
Mr. Fluff, I found the problem, was my sheet like you said, grey color was in some cells, thank you for all your help.
 
Upvote 0

Forum statistics

Threads
1,215,646
Messages
6,126,002
Members
449,279
Latest member
Faraz5023

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