简体   繁体   中英

How to copy conditional formatting when copying value within if check?

I have a check such as

=IF(A1="","",Sheet2!A1)

Where Sheet2!A1 contains a conditional formatted cell (colored a specific color)

I want to keep the color on my new sheet

How can I copy the cell, its value and its formatting?

Can this be accomplished within a formula or is there something in VBA I can write that will do this

Can this be accomplished within a formula?

AFAIK, I don't think you can do this using excel formula

VBA Code:

Select the cell where you had the formula and run the macro

Sub ColorCopyCell()
If (IsEmpty(ActiveCell)) Then 'If empty
Worksheets(2).Range(ActiveCell.Address).Copy
Selection.PasteSpecial Paste:=xlPasteAll
End If
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM