COLOR OF CELL OF A COL WHEN CHANGED THEN CELL COLOR OF B ALSO CHANGED

AFZAL SOHAIL

Board Regular
Joined
May 31, 2023
Messages
116
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
Hello Respected Team:-
I have a question that if I change the color of Cell in col-A then color of adjacent col-b cell should changed is as under:-
I need a formula.
FZRD: OLT-1 to C-10 Main Chungi AmrsadhuTNSP
SMD: B-36 Opp. Shadman Market to B-1 Bagh Gul BegumSMD
SMD: B-25 Cricket House to C-5 Services HospitalSMD
8057-FZRD (11/0/3) to 7301-Ufone (2/0/2)TNSP
MLRD: OLT-1 to C-41 SabzazarSMD
MAL: MSAG-13 Sundar Industrial Estate to MSAG-15 Sundar Industrial EstateJTN
8062-WTN to 7038-UfoneTNSP
GTN: C-2 P-Block GLB-III to C-2A Main Enterance GOR-VI Opp. Arfa Karim TowerGTN
JTN --- BTNJTN
FZRD --- TNSPTNSP
GTN: OLT-2 to 94-S Block Model TownGTN
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Please review the Forum Rules, particularly #14 regarding the use of all upper case in your thread titles. Thanks.
 
Upvote 0
Ok Sir.
I am sorry for this, I do not know to break the rule, in future I will be careful.
 
Upvote 0
How are the colours being changed in column A?
  1. Manually
  2. Conditional Formatting
  3. VBA code
 
Upvote 0
Dear Sir,
Manually
Well, there is no 'event' for excel to capture when you manually colour a cell. The best I can come up with is a way to replicate the colours from Col A into Col B but only when the selection is changed. So if you select A8 and colour it red, B8 will not turn red until your select some cell other than A8. See if it is any use to you.
Note that this also copies any other formatting as well (eg Bold font, cell borders etc)

To implement my idea..
1. Right click the sheet name tab and choose "View Code".
2. Copy and Paste the code below into the main right hand pane that opens at step 1.
3. Close the Visual Basic window & test by selecting any cell (or cells) in Col A and apply a colour (or remove an existing colour) then move to some other cell.
4. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm).

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  Dim s As Range, ac As Range

  Set s = Selection
  Set ac = ActiveCell
  Application.ScreenUpdating = False
  Application.EnableEvents = False
  With Intersect(ActiveSheet.UsedRange, Columns("A"))
    .Copy
    .Offset(, 1).PasteSpecial Paste:=xlPasteFormats
  End With
  Application.CutCopyMode = False
  s.Select
  ac.Activate
  Application.EnableEvents = True
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Dear sir,
These codes are working very well as i want.
If possible to make a formula, because these type of report to sent my department and I want to sent without any vba code
 
Upvote 0
It is not possible for a formula to detect when colour is applied to another cell.
 
Upvote 0

Forum statistics

Threads
1,215,924
Messages
6,127,725
Members
449,401
Latest member
TTXS

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