Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Got a good one!!!!

  1. #11

    Join Date
    Apr 2002
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-24 11:56, charlie79 wrote:
    Please bare with me, but is this right?

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

    Range(Target).Font.Color = RGB(255, 0, 0)

    End Sub

    It must not be, since I get a run-time error: "Method 'Range' of object'_Global' failed."

    Enlighten me...

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Target.Font.Color = RGB(255, 0, 0)
    End Sub

  2. #12
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Change:

    Range(Target).Font.Color = RGB(255, 0, 0)

    To:

    Target.Font.Color = RGB(255, 0, 0)

    I think?

    Just a note. Your code as is will change every changed cell in your workbook to red...

    Should use the Worksheet_Change and apply a condition such as a specific range...

    Use:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 1 And Target.Row < 11 Then
    Target.Font.Color = RGB(255, 0, 0)
    Target.HorizontalAlignment = xlLeft
    End If
    End Sub
    Tom

    [ This Message was edited by: TsTom on 2002-04-25 06:06 ]

  3. #13
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    That's it guys! Thanks a lot.



    How long a minute is depends on which side of the bathroom door you are standing...

    Cheers

  4. #14
    New Member
    Join Date
    Apr 2002
    Location
    Lawrence, KS
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-25 05:42, charlie79 wrote:
    No, that didn't seem to work. I don't know if I'm missing something, but that event does not get run when I type values into cells and press enter. I know this cause I set a breakpoint at the sub, and it didn't break.
    Oh, really, so why does it work now?

  5. #15
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-25 08:16, dhoffman wrote:
    On 2002-04-25 05:42, charlie79 wrote:
    No, that didn't seem to work. I don't know if I'm missing something, but that event does not get run when I type values into cells and press enter. I know this cause I set a breakpoint at the sub, and it didn't break.
    Oh, really, so why does it work now?
    Sorry if I upset you dhofman, but you suggested using the Worksheet_Change event, when I should be using the Workbook_SheetChange event. Again, sorry to have upset you, but....

    Besides, I like TSTOM better than you .?.?.?

    _________________
    How long a minute is depends on which side of the bathroom door you are standing...

    Cheers

    [ This Message was edited by: charlie79 on 2002-04-25 10:29 ]

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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