Hi,
Need a help with vb code for IF statement which I am not getting correct results based on the condition.
Hi,
Need a help with vb code for IF statement which I am not getting correct results based on the condition.
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?
Guess code
![]()
Please Login or Register to view this content.
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.
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
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.
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks