+ Reply to Thread
Results 1 to 3 of 3

Simple VB query

  1. #1
    Registered User
    Join Date
    11-10-2004
    Posts
    23

    Question Simple VB query

    This should be an easy one to solve.

    In my VB macro code, I want to make a check on a cell's entry, but my mind just isn't working tonight.

    If Cell B4 = 1, then I want my VB code to check this.

    So I want my code to do this:

    If B4 = 1 Then
    some code
    some code
    some code
    End If

    But what do I put after the 'If' statement to make the check? I know that the code above doesn't work, but do I have to put something like:

    "If ActiveWorkbook.B4=1 Then..."

    Or something similar?

    Basically, what do I have to put in the If statement for the code to check the contents of cell B4???

    Thanks.

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    sheets("sheet1").select ' the sheet where you have to check for criteria.

    if range("B4").value=1 then

    ' your code

    end if

  3. #3
    Registered User
    Join Date
    11-10-2004
    Posts
    23
    Crikey, I knew it was simple!

    Of course, thanks very much. I can't believe it was so simple.


+ 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