How to make secondary cells color of primary
Closed
markhackney
-
5 Feb 2012 à 22:04
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 14 Feb 2012 à 09:25
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 14 Feb 2012 à 09:25
Related:
- How to make secondary cells color of primary
- Html text color - Guide
- Color 65535 - Guide
- How to change notepad background color - Guide
- Sound card color code - Guide
- How to change primary email on facebook - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
14 Feb 2012 à 09:25
14 Feb 2012 à 09:25
Hi markhackney,
Yes this is possible, but what is the relation between A1 and B1:Z1+C7+E74.
For the following code I assumed that A1 could be any cell and that B1:Z1 is dependent of the row of the selected cell (so if A2 is selected then it will be B2:Z2). C7 and E74 are fixed locations.
First select the cell you would like to copy the color from and then run the following code:
Best regards,
Trowa
Yes this is possible, but what is the relation between A1 and B1:Z1+C7+E74.
For the following code I assumed that A1 could be any cell and that B1:Z1 is dependent of the row of the selected cell (so if A2 is selected then it will be B2:Z2). C7 and E74 are fixed locations.
First select the cell you would like to copy the color from and then run the following code:
Sub Test()
Dim aColor, aRow As Integer
aColor = ActiveCell.Interior.ColorIndex
aRow = ActiveCell.Row
Range(Cells(aRow, "B"), Cells(aRow, "Z")).Interior.ColorIndex = aColor
Range("C7").Interior.ColorIndex = aColor
Range("E74").Interior.ColorIndex = aColor
End Sub
Best regards,
Trowa