PDA

View Full Version : reference cell font color and value



slashiiboy
10-19-2018, 06:00 PM
Hello, I have a series of data on one excel sheet, I need to reference this values and font colors to another sheet , since this data is constantly changing and both sheets need to have the same value and font color I was trying the following in VBA:


Public Function Value_color(ByVal cell as Range) As string
Value_color=Format(cell,cell.NumberFormat)
End Function




It is worth mentioning that the source cell has a number format but the receiver cell can be anything such as String.

Paul_Hossler
10-19-2018, 06:21 PM
One way would be to have the data copied from Sheet1 whenever Sheet2 is activated



Option Explicit

'in destination sheet code module

Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Application.EnableEvents = False

'sheet1 is the source, sheet2 is the destination
Worksheets("Sheet1").Range("B2:B13").Copy Worksheets("Sheet2").Range("B2:B13")
Worksheets("Sheet1").Range("D2:D13").Copy Worksheets("Sheet2").Range("D2:D13")
Application.EnableEvents = True
Application.ScreenUpdating = True


End Sub