+ Reply to Thread
Results 1 to 4 of 4

IF Statement

  1. #1
    Registered User
    Join Date
    06-07-2008
    Posts
    31

    IF Statement

    Hi,

    Is the a function that does:

    IF A2-A5="yes" then copy contents of A1-A3?

    Thanks

  2. #2
    Forum Contributor wmorrison49's Avatar
    Join Date
    09-25-2007
    Posts
    267
    I am a little confused by your phrasing. Are you saying if A2 minus A5 equals "yes" then do something? Or if the word "yes" appears in that range?

  3. #3
    Registered User
    Join Date
    06-07-2008
    Posts
    31
    Hi sorry,

    Its if any column in that range appear with the word yes in it.

    Thanks

  4. #4
    Forum Contributor wmorrison49's Avatar
    Join Date
    09-25-2007
    Posts
    267
    Here's some code that looks in the range A2:A5 and if there is a "Yes" anywhere in there, copies cells A1:A3 to cells C1:C3.

    Range("A2").Select
    If ActiveCell = "Yes" Or ActiveCell.Offset(1, 0) = "Yes" Or ActiveCell.Offset(2, 0) = "Yes" Or ActiveCell.Offset(3, 0) = "Yes" Then
    Range("A1:A3").Select
    Selection.Copy
    Range("C1").Select
    ActiveSheet.Paste
    End If
    Hope that's what you were looking for.

+ 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