+ Reply to Thread
Results 1 to 2 of 2

variable not defined error

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-26-2010
    Location
    usa
    MS-Off Ver
    Office 365
    Posts
    1,233

    variable not defined error

    Hello

    wondering if someone can help me with defining the variable "C"

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    On Error Resume Next
    'Loop through myRng
      For Each c In Sheets(1).Range("myRng")
    'Strip off "=SHEET1!" from the formula, leaving just
    'the cell reference e.g. E11
       addStr = Right(c.Formula, Len(c.Formula) _
                - WorksheetFunction.Find("!", c.Formula))
    'Set the Font color based on the Font color of the
    'referenced cell in Sheet2
       c.Font.ColorIndex = Sheets(2).Range(addStr).Font.ColorIndex
     Next
    End Sub
    im not strong with vba at all, so any help is appreciated.
    basically, the macro strips off the "=" sign off and retains the font color etc.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: variable not defined error

    Dim c as Range
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1