Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I am attempting to copy the color formatting from one cell to another on a
different worksheet. I do not see a function for it so I was wondering if there was some VBA code to do it. Here is an example of what I am trying to do: Worksheet A has A1 formatted with red, A2 formatted with yellow, and A3 formatted with green. All which are conditionally formatted. On worksheet B, I want to reference A1 (or any cell) from worksheet A which would include the contents and color. Any help is appreciated! Rich |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
This is only partially useful:
Sub format_painter() Dim r, r2 As Range Dim s As String Dim b As Boolean For Each r In Selection If r.HasFormula Then s = r.Formula s = Right(s, Len(s) - 1) On Error Resume Next Set r2 = Range(s) On Error GoTo 0 b = Not r2 Is Nothing If b Then r2.Copy r.PasteSpecial Paste:=xlPasteFormats End If End If Next End Sub If you select a cell that has a direct reference like: =Sheet2!A3 and run the macro, it will go back to Sheet2, cell A3, copy and format-paste it to the target. I say partially successful because it can't copy complicated formats. -- Gary's Student "Rich Young" wrote: I am attempting to copy the color formatting from one cell to another on a different worksheet. I do not see a function for it so I was wondering if there was some VBA code to do it. Here is an example of what I am trying to do: Worksheet A has A1 formatted with red, A2 formatted with yellow, and A3 formatted with green. All which are conditionally formatted. On worksheet B, I want to reference A1 (or any cell) from worksheet A which would include the contents and color. Any help is appreciated! Rich |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Thanks Gary, I will give it a try!
"Gary''s Student" wrote: This is only partially useful: Sub format_painter() Dim r, r2 As Range Dim s As String Dim b As Boolean For Each r In Selection If r.HasFormula Then s = r.Formula s = Right(s, Len(s) - 1) On Error Resume Next Set r2 = Range(s) On Error GoTo 0 b = Not r2 Is Nothing If b Then r2.Copy r.PasteSpecial Paste:=xlPasteFormats End If End If Next End Sub If you select a cell that has a direct reference like: =Sheet2!A3 and run the macro, it will go back to Sheet2, cell A3, copy and format-paste it to the target. I say partially successful because it can't copy complicated formats. -- Gary's Student "Rich Young" wrote: I am attempting to copy the color formatting from one cell to another on a different worksheet. I do not see a function for it so I was wondering if there was some VBA code to do it. Here is an example of what I am trying to do: Worksheet A has A1 formatted with red, A2 formatted with yellow, and A3 formatted with green. All which are conditionally formatted. On worksheet B, I want to reference A1 (or any cell) from worksheet A which would include the contents and color. Any help is appreciated! Rich |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating a Custom Excel Function to Calculate Gini Coefficients | Excel Worksheet Functions | |||
Date & Time | New Users to Excel | |||
Hyperlinks using R[1]C[1] and offset function in its cell referenc | Excel Worksheet Functions | |||
Conversion | Excel Worksheet Functions | |||
HOW CAN I GET OFFICE 2003 EXCEL BASIC TO NEST FUNCTIONS LIKE EXCE. | Excel Worksheet Functions |