Hi,
This is a really simple one but I can't get it to work:
I have a dropdown list with Yes or No in cell M14.
I need the VBA code for:
When M14 = Yes and M16 = "" (empty)
for a message box to appear with "Please state the Filename"
Many thanks
Last edited by jammy78; 01-27-2012 at 04:50 AM.
try this way ... type below code in your sheet's code
Private Sub Worksheet_Change(ByVal Target As Range) if target.address = "$M$14" or target.address = "$m$16" then if range("m14").value = "Yes" and range("m16").value = "" then MsgBox "test message" end if End Sub
Best Regards
MaczaQ
---------------------------------------------------------------------------------------------------------------------------
If you are satisfied with the solution(s) provided, please mark your thread as Solved
If you are pleased with my answer consider to use the Scales iconto rate it - This way you will add me some reputation points ... thanks in advance.
Sorry, I should have probably said - I want to add the code to an existing command.
This is some of the code in the command:
So I need to add it to this!Sub AddDesk_Click() If Range("D4").Value = "" Then MsgBox ("Please insert Project Name") Exit Sub End If If Range("D6").Value = "" Then MsgBox ("Please insert Contact Name") Exit Sub End If If Range("D8").Value = "" Then MsgBox ("Please insert Pay or Warrant Number") Exit Sub End If If Range("D10").Value = "" Then MsgBox ("Please insert a Tel Number") Exit Sub End If
see the code provided by maczaq and change it for yr needs
as an option
Sub Button2_Click() If Range("m14").Value = "Yes" And Range("m16").Value = "" Then MsgBox "Please insert a Tel Number" End Sub
Regards, John
nothing more to say that john55 wrote
maybe shorter code ?
Sub AddDesk_Click() If Range("D4").Value = "" Then MsgBox ("Please insert Project Name"): Exit Sub If Range("D6").Value = "" Then MsgBox ("Please insert Contact Name"): Exit Sub If Range("D8").Value = "" Then MsgBox ("Please insert Pay or Warrant Number"): Exit Sub If Range("D10").Value = "" Then MsgBox ("Please insert a Tel Number"): Exit Sub If Range("m14").Value = "Yes" And Range("m16").Value = "" Then MsgBox "Please insert a Tel Number" End Sub
Best Regards
MaczaQ
---------------------------------------------------------------------------------------------------------------------------
If you are satisfied with the solution(s) provided, please mark your thread as Solved
If you are pleased with my answer consider to use the Scales iconto rate it - This way you will add me some reputation points ... thanks in advance.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks