Here's the Vb Code I used but I keep getting a "Argument Not Optional" message box.
I want for the macro to run if the value equals to "Iawn I Bwcio". But if the value equals to "Dyddiad Anghywir"
then I want a message box to appear and say ;
"Mae yna dyddiad anghywir wedi ei fewnbynnu! Mae angen newid hyn er mwyn cario ymlaen!"
Thanks in advanced, Owen.
I want for the macro to run if the value equals to "Iawn I Bwcio". But if the value equals to "Dyddiad Anghywir"
then I want a message box to appear and say ;
"Mae yna dyddiad anghywir wedi ei fewnbynnu! Mae angen newid hyn er mwyn cario ymlaen!"
Code:
Private Sub mewbynnuDataSioe(ByVal target As Range)
If (Range(D5) = "Iawn I Bwcio") Then
'
' Mewnbynnu_Data_Sioe Macro
'
' Keyboard Shortcut: Ctrl+Shift+Q
'
Range("E3").Select
ActiveCell.FormulaR1C1 = "1"
Range("E4").Select
ElseIf (Range(D5) = "Dyddiad Anghywir") Then
MsgBox "Mae yna dyddiad anghywir wedi ei fewnbynnu! Mae angen newid hyn er mwyn cario ymlaen!"
End With
End If
Exit Sub
End Sub
Last edited by a moderator: