簡體   English   中英

在if check中復制值時如何復制條件格式?

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

我有一張支票,例如

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

其中Sheet2!A1包含條件格式的單元格(為特定顏色上色)

我想在新紙上保留顏色

如何復制單元格,其值和格式?

可以在公式中完成此操作,還是可以在VBA中寫一些東西來做到這一點?

Can this be accomplished within a formula?

AFAIK,我認為您無法使用excel公式執行此操作

VBA代碼:

選擇具有公式的單元格並運行宏

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM