Issue with Code to paint cell

mari_hitz

Board Regular
Joined
Jan 25, 2011
Messages
101
Hi everyone!

I hope you can help me with this little difficulty I have. Someone created a Q&A game in excel. So, in a cell you have to choose from a dropdown "True" or "False" and after you have completed all the answers, you click in a button that checks your answers. If the answer is wrong the cell next to your question will be painted into red and will tell you why you are wrong. I have tried to make the wrong to come up as a message box with the right answer, however I have failled doing it.
So I sticked with what it was given to me. The code works just fine, however when I change the phrase after the "wrong.." part in the code, the cell does not paint. Do you have any idea why this is happening?

Here it is the code that I was given:(It has parts in spanish):
Code:
Sub Macro1()

Application.ScreenUpdating = False
 
    Range("D14").Select
    
    ActiveCell.FormulaR1C1 = "=IF(RC[-1],""Correct"",""Sos Malisimo! Porque..."")"
    
    Range("D16").Select
    
    ActiveCell.FormulaR1C1 = "=IF(RC[-1],""Correct"",""Sos Malisimo! Porque..."")"
    
    Range("D18").Select
    
    ActiveCell.FormulaR1C1 = "=IF(RC[-1],""Correct"",""Wrong. You should only write your first name. "")"
    
    Range("D20").Select
    
    ActiveCell.FormulaR1C1 = "=IF(RC[-1],""Correct"",""Wrong. The SR will become invisible for the customer if you select the Contact Method “Internal” "")"
    
    Range("D22").Select
    
    ActiveCell.FormulaR1C1 = "=IF(RC[-1],""Correct"",""Wrong. You should use “Pending” as the status of your SR when waiting on external dependencies (e.g. information from assignee)"")"
    
    Range("D24").Select
    
    ActiveCell.FormulaR1C1 = "=IF(RC[-1],""Correct"",""Wrong. The protocol for sending e-mails from a myRequests SR is as follows: • RMS creates a SR for someone (or CRM creates a SR for someone) • Others must be on CC • There is imminent escalation risk"")"
 
    Range("D14:D24").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("A1").Select
    Application.CutCopyMode = False
    
    End Sub

Thanks!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
The colours are probably triggered by conditional formatting, so check that first.
 
Upvote 0
Hi I am new to the forums so I apologize if I missed the part in the code where it highlights the cell in red.

I have done something like this before and the code went like this...

If activecell.value = "Wrong" then
Selection.Interior.ColorIndex = 3
End if

Hope this helps :-)
 
Upvote 0
Not in isolation like that. Where is that bit of code located?
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top