+ Reply to Thread
Results 1 to 7 of 7

Need help with IF statement code, results not appearing correctly

  1. #1
    Registered User
    Join Date
    04-19-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    49

    Need help with IF statement code, results not appearing correctly

    Hi,

    Need a help with vb code for IF statement which I am not getting correct results based on the condition.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need help with IF statement code, results not appearing correctly

    What do you want to do if the condition is true or false? Which cell do you want to copy if it is true and if it is false?

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need help with IF statement code, results not appearing correctly

    Guess code

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-19-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Need help with IF statement code, results not appearing correctly

    The next cell of the data the results have to be shown and can you tell me what was the error in coding. As I have to use with multiple if conditions and first trying to fix with one condition to see if it works or not.

  5. #5
    Registered User
    Join Date
    06-12-2013
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Need help with IF statement code, results not appearing correctly

    Need help with IF statement code, results not appearing correctly
    here's your workbook solved

    Sub ifstart1()
    Application.ScreenUpdating = False
    Sheets("Sheet1").Select
    Range("D13").Select
    ActiveCell.FormulaR1C1 = "=IF(RC[-2]>4,""Succes"",""Not"")"
    Range("D13").Copy
    Range("D13:D18").Select
    ActiveSheet.Paste
    Range("D13:D18").Copy
    Range("C13:C18").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("D13:D18").ClearContents
    Range("C13").Select
    End if
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need help with IF statement code, results not appearing correctly

    You are using a fixed range, so the code will not loop. It only works with a single cell.
    The code first test if cell 13 is greater than 4. As it is 1 (<4), it returns false "Not". It then copy that cell in range 14-18.

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need help with IF statement code, results not appearing correctly

    Adriasniq,
    Welcome to the forum!
    Unfortunately, your post does not comply with form's rule. You need to start your own thread. When you post a new thread, you will get a reply if you could include a proper heading which reflects your request.

+ 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