ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help with empty cell in Macro (https://www.excelbanter.com/excel-programming/311911-need-help-empty-cell-macro.html)

don

Need help with empty cell in Macro
 
set var2 in macro that returns " " when cell is empty.
Need statement that says If var1 = x or var1 = y and
var2 not " " Then

Can anyone help?

No Name

Need help with empty cell in Macro
 
hi,
if var1 = "x" or var1 = "y" and var2 not isempty then

-----Original Message-----
set var2 in macro that returns " " when cell is empty.
Need statement that says If var1 = x or var1 = y and
var2 not " " Then

Can anyone help?
.


Tom Ogilvy

Need help with empty cell in Macro
 
if (Var1 = x or var2 = y ) and not (var2 = " ") then

--
Regards,
Tom Ogilvy

"Don" wrote in message
...
set var2 in macro that returns " " when cell is empty.
Need statement that says If var1 = x or var1 = y and
var2 not " " Then

Can anyone help?




Kris

Need help with empty cell in Macro
 
Not quite.

1) IsEmpty is a function. So the correct use of a
function would be something more like:

If Not IsEmpty(var2)

2) IsEmpty returns True if the variable has not been
initialized, not if the variable is blank. And there is
a difference between the two. The following example
illustrates this:

Dim var1 As String
Dim var2

If IsEmpty(var1) Then
MsgBox "Var1 is Empty"
End If

If IsEmpty(var2) Then
MsgBox "Var2 is Empty"
End If


Sincerely,

Kris

-----Original Message-----
hi,
if var1 = "x" or var1 = "y" and var2 not isempty then

-----Original Message-----
set var2 in macro that returns " " when cell is

empty.
Need statement that says If var1 = x or var1 = y and
var2 not " " Then

Can anyone help?
.

.


Tom Ogilvy

Need help with empty cell in Macro
 
Typo: (should be)

if (Var1 = x or var1 = y ) and not (var2 = " ") then

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
if (Var1 = x or var2 = y ) and not (var2 = " ") then

--
Regards,
Tom Ogilvy

"Don" wrote in message
...
set var2 in macro that returns " " when cell is empty.
Need statement that says If var1 = x or var1 = y and
var2 not " " Then

Can anyone help?







All times are GMT +1. The time now is 01:26 PM.

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