ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Run macro Once (https://www.excelbanter.com/excel-worksheet-functions/214979-run-macro-once.html)

PR[_2_]

Run macro Once
 
Can anyone let me know how to get this code to work when there is a null
entry in X1...

Worksheets("qry_aga_corps").Activate
Range("X1").Select
If ActiveCell isnull Then

"Run Code"

Else
MsgBox ("The Macro has already been activiated once, cannot run
twice")
End If

Regards - Paul



Don Guillett

Run macro Once
 
with Worksheets("qry_aga_corps")
if len(trim(Range("X1")))<1 then
"Run Code"
'I assume that code puts somehing in cell x1
Else
MsgBox ("The Macro has been run once, cannot run twice")
End If


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"PR" wrote in message
...
Can anyone let me know how to get this code to work when there is a null
entry in X1...

Worksheets("qry_aga_corps").Activate
Range("X1").Select
If ActiveCell isnull Then

"Run Code"

Else
MsgBox ("The Macro has already been activiated once, cannot run
twice")
End If

Regards - Paul



Don Guillett

Run macro Once
 
OOPS
with Worksheets("qry_aga_corps")
if len(application.trim(.Range("X1")))<1 then
"Run Code"
'I assume that code puts somehing in cell x1
Else
MsgBox ("The Macro has been run once, cannot run twice")
End If
end with


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
with Worksheets("qry_aga_corps")
if len(trim(Range("X1")))<1 then
"Run Code"
'I assume that code puts somehing in cell x1
Else
MsgBox ("The Macro has been run once, cannot run twice")
End If


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"PR" wrote in message
...
Can anyone let me know how to get this code to work when there is a null
entry in X1...

Worksheets("qry_aga_corps").Activate
Range("X1").Select
If ActiveCell isnull Then

"Run Code"

Else
MsgBox ("The Macro has already been activiated once, cannot run
twice")
End If

Regards - Paul




PR[_2_]

Run macro Once
 
Don,
Many thanks for your help and your time it works...

regards Paul



Don Guillett

Run macro Once
 
Glad to help.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"PR" wrote in message
...
Don,
Many thanks for your help and your time it works...

regards Paul




All times are GMT +1. The time now is 10:15 AM.

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