Consulting

Results 1 to 2 of 2

Thread: reference cell font color and value

  1. #1

    reference cell font color and value

    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.

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    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
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •