Results 1 to 5 of 5

If statement doesn't work for range?

Threaded View

  1. #1
    Registered User
    Join Date
    01-09-2007
    Posts
    54

    If statement doesn't work for range?

    I was wondering if anyone could tell me why this code doesn't work? I'm just playing around with some codes to see what can work.

    Private Sub CommandButton1_Click()
    myRng = Range("a1", Range("a1").End(xlDown)).value
    If myRng = 2 Then
    MsgBox ("yes")
    End If
    End SubThe following code does work

    Range("a1", Range("a1").End(xlDown)).value = 2

    This sets the whole range of cells to 2, so why can't you call an IF statement to see what the value is?

    Alex
    Last edited by deeppurple247; 02-07-2007 at 05:47 PM.

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