ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   If Then macro needed (https://www.excelbanter.com/excel-worksheet-functions/154189-if-then-macro-needed.html)

Roger

If Then macro needed
 
I have a situation where I need to insert a line of code into a macro I have,
but I need some help.

I need to have the macro present a message to the user if any number is
present in a particular cell.

So basically this: If cell a7 contains "any number" then message box "this
cell contains QTY"...

thanks in advance for the assistance.

Toppers

If Then macro needed
 
try:

If IsNumeric(Range("A7")) And Range("A7") < "" Then
MsgBox "This cell contains QTY " & Range("A7")
End If

"Roger" wrote:

I have a situation where I need to insert a line of code into a macro I have,
but I need some help.

I need to have the macro present a message to the user if any number is
present in a particular cell.

So basically this: If cell a7 contains "any number" then message box "this
cell contains QTY"...

thanks in advance for the assistance.


Roger

If Then macro needed
 
Perfect, almost.... Is there are way to make it so when this does happen,
the macro will stop where the situation occured?

"Toppers" wrote:

try:

If IsNumeric(Range("A7")) And Range("A7") < "" Then
MsgBox "This cell contains QTY " & Range("A7")
End If

"Roger" wrote:

I have a situation where I need to insert a line of code into a macro I have,
but I need some help.

I need to have the macro present a message to the user if any number is
present in a particular cell.

So basically this: If cell a7 contains "any number" then message box "this
cell contains QTY"...

thanks in advance for the assistance.


Don Guillett

If Then macro needed
 
Maybe? have a look in the vba help index for INSTR

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Roger" wrote in message
...
Perfect, almost.... Is there are way to make it so when this does happen,
the macro will stop where the situation occured?

"Toppers" wrote:

try:

If IsNumeric(Range("A7")) And Range("A7") < "" Then
MsgBox "This cell contains QTY " & Range("A7")
End If

"Roger" wrote:

I have a situation where I need to insert a line of code into a macro I
have,
but I need some help.

I need to have the macro present a message to the user if any number is
present in a particular cell.

So basically this: If cell a7 contains "any number" then message box
"this
cell contains QTY"...

thanks in advance for the assistance.



Toppers

If Then macro needed
 


If IsNumeric(Range("A7")) And Range("A7") < "" Then
MsgBox "This cell contains QTY " & Range("A7")
Exit sub ' (or END)
End If



"Roger" wrote:

Perfect, almost.... Is there are way to make it so when this does happen,
the macro will stop where the situation occured?

"Toppers" wrote:

try:

If IsNumeric(Range("A7")) And Range("A7") < "" Then
MsgBox "This cell contains QTY " & Range("A7")
End If

"Roger" wrote:

I have a situation where I need to insert a line of code into a macro I have,
but I need some help.

I need to have the macro present a message to the user if any number is
present in a particular cell.

So basically this: If cell a7 contains "any number" then message box "this
cell contains QTY"...

thanks in advance for the assistance.



All times are GMT +1. The time now is 04:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com