Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
don don is offline
external usenet poster
 
Posts: 21
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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?
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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?
.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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?







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Macro to Find First Empty Cell Jenny B. Excel Discussion (Misc queries) 3 January 10th 08 03:25 AM
Macro code for dropping to next empty cell JB2010 Excel Discussion (Misc queries) 4 November 3rd 05 01:35 PM
Getting a macro to see the next available empty cell Mark 688 Excel Discussion (Misc queries) 1 September 9th 05 04:19 PM
macro to look for empty cell esrei Excel Discussion (Misc queries) 1 April 14th 05 11:57 AM
if cell empty hide row macro? Todd Excel Programming 2 June 18th 04 07:18 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"