Results 1 to 7 of 7

How can I use the .value code?

Threaded View

  1. #1
    Registered User
    Join Date
    11-12-2007
    Posts
    30

    How can I use the .value code?

    Hi,
    I got the following bit of code from this forum a few days ago:
    Private Sub Worksheet_Calculate()
    Dim TheRange As Range
    Dim TheCell As Range
    
    Set TheRange = Range("H8", Range("AK11"))
    For Each TheCell In TheRange
    If TheCell.Value < 0 Then
                TheCell.Offset(-4, 0).Range("A1").Interior.ColorIndex = 3
            ElseIf TheCell.Value = 0 Then
                TheCell.Offset(-4, 0).Range("A1").Interior.ColorIndex = 6
            ElseIf TheCell.Value >= 1 Then
                TheCell.Offset(-4, 0).Range("A1").Interior.ColorIndex = 4
            End If
        
        Next TheCell
    End Sub
    It works beautifully. I was just wondering about the .value extension, as essentially I want to modify one of the following to check for the letter X, rather than a number

            ElseIf TheCell.Value >= 1 Then
                TheCell.Offset(-4, 0).Range("A1").Interior.ColorIndex = 4
    Can I use the .Value extension or do I need to use another tag? I tried using

    .value = X
    but it doesn't seem to work. What can I do? Is the >=1 bit the problem? If so, can I limit this to >=1 and <=99, and how can I do this?
    Last edited by cannon_lab; 12-20-2007 at 07:02 AM.

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