user9184557
user9184557

Reputation: 92

Copy Colors but not conditional formatting

Please help me to understand how to Copy Colors from a specific cell but not conditional formatting.

For example

My Range A1 and A2 are merged cell with red color and with some value on it and I have to copy only that red color to Range B1 and B2 which have some different values. Is there any provision to satisfy it?

I tried

Range("A1:A2").Copy

Range("B1:B2").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

but this will copy paste and merge the cell B1 and B2

Upvotes: 0

Views: 6972

Answers (3)

user16391416
user16391416

Reputation: 11

The issue of copying to a word document, remove the figure but retain the colours and paste back to excel. Works perfectly okay. This world most times need simple solutions.

Upvotes: 0

Havard Kleven
Havard Kleven

Reputation: 421

I would create a function to detect the backcolor (.Interor) if desired cells, and store these values as your “Copied colors”.

Example of a function to get the RGB-value of a desired cell:

Function getRGB(rcell) As String
    Dim colorVal As String

    colorVal = Right("000000" & Hex(rcell.Interior.Color), 6)
    getRGB = Right(colorVal, 2) & Mid(colorVal, 3, 2) & Left(colorVal, 2)
End Function

Upvotes: 2

Prem Kumar
Prem Kumar

Reputation: 21

Copy A1:A2 and paste directly in a new ms-word doc. Then again copy this from ms-word and paste it anywhere in excel (say C1:C2). Now copy format from C1:C2 and paste at required range as mentioned B1:B2. Delete C1:C2 now. This is how I manege in such scenario !!

Upvotes: 0

Related Questions