![]() |
Msgbox if cell is not a value
Hi,
If cell is not a value I want a messagebox. I have no problems creating the msgbox, but how do I write the macro checking for a value? Thanks for any help. Kaj Pedersen |
Msgbox if cell is not a value
A particular value?
If Range("A2").Value2 < 17 Then MsgBx "error" or any value? If Range("A2").Value2 < "" Then MsgBx "error" -- HTH Bob "KP" <none wrote in message ... Hi, If cell is not a value I want a messagebox. I have no problems creating the msgbox, but how do I write the macro checking for a value? Thanks for any help. Kaj Pedersen |
Msgbox if cell is not a value
Hi Bob,
Your first excamle works perfectly but I'm sorry to say that there seems to be some trouble with the second one. I want a msgbox if a text or anything else but a value is typed in cell A2. If I use the macro below, I get the Msgbox, no matter what I write in A2, even if I write a value. If Range("A2").Value2 < "" Then MsgBox "error" End If Hope you can figure out the problem. I use Excel 2003, danish Kaj Pedersen "Bob Phillips" skrev i en meddelelse ... A particular value? If Range("A2").Value2 < 17 Then MsgBx "error" or any value? If Range("A2").Value2 < "" Then MsgBx "error" -- HTH Bob "KP" <none wrote in message ... Hi, If cell is not a value I want a messagebox. I have no problems creating the msgbox, but how do I write the macro checking for a value? Thanks for any help. Kaj Pedersen |
Msgbox if cell is not a value
How about
If Range("A2").Value2 < "" And Not IsNumeric(Range("A2").Value2) Then MsgBox "error" End If -- HTH Bob "KP" <none wrote in message ... Hi Bob, Your first excamle works perfectly but I'm sorry to say that there seems to be some trouble with the second one. I want a msgbox if a text or anything else but a value is typed in cell A2. If I use the macro below, I get the Msgbox, no matter what I write in A2, even if I write a value. If Range("A2").Value2 < "" Then MsgBox "error" End If Hope you can figure out the problem. I use Excel 2003, danish Kaj Pedersen "Bob Phillips" skrev i en meddelelse ... A particular value? If Range("A2").Value2 < 17 Then MsgBx "error" or any value? If Range("A2").Value2 < "" Then MsgBx "error" -- HTH Bob "KP" <none wrote in message ... Hi, If cell is not a value I want a messagebox. I have no problems creating the msgbox, but how do I write the macro checking for a value? Thanks for any help. Kaj Pedersen |
Msgbox if cell is not a value
Hi again,
This proposal fully comply with my wishes. Thank you. Kaj Pedersen "Bob Phillips" skrev i en meddelelse ... How about If Range("A2").Value2 < "" And Not IsNumeric(Range("A2").Value2) Then MsgBox "error" End If -- HTH Bob "KP" <none wrote in message ... Hi Bob, Your first excamle works perfectly but I'm sorry to say that there seems to be some trouble with the second one. I want a msgbox if a text or anything else but a value is typed in cell A2. If I use the macro below, I get the Msgbox, no matter what I write in A2, even if I write a value. If Range("A2").Value2 < "" Then MsgBox "error" End If Hope you can figure out the problem. I use Excel 2003, danish Kaj Pedersen "Bob Phillips" skrev i en meddelelse ... A particular value? If Range("A2").Value2 < 17 Then MsgBx "error" or any value? If Range("A2").Value2 < "" Then MsgBx "error" -- HTH Bob "KP" <none wrote in message ... Hi, If cell is not a value I want a messagebox. I have no problems creating the msgbox, but how do I write the macro checking for a value? Thanks for any help. Kaj Pedersen |
All times are GMT +1. The time now is 09:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com