View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default If Range ("C22") < = 0

IsEmpty is nice because it finds TRUE empties rather than pseudo-empties.

Start with a new, fresh worksheet and in A1 enter:
=""

If you now copy A1 and:
Edit Paste Special Values into A2 and then run:

Sub HowEmptyIsIt()
For Each r In Range("A1:A3")
MsgBox (r.Address & IsEmpty(r))
Next
End Sub

VBA will tell you that there is SOMETHING in A1 and A2.

Same behavior as =COUNTA() and =ISBLANK() in the worksheet.
--
Gary''s Student - gsnu200813


"jafsonic" wrote:

On Nov 13, 8:32 am, Lav wrote:
Embarressing I thougth I knew the answer

My macro populates the cell if the relevant cell it is reading from
(in another wb has data in it).

If there is no data in it how do I put a 0 in that cell (C22)?

Thanks


I like Gary's Student's IsEmpty method, but I probably would have used
the cells(22,3) reference rather than range("c22") - that' probably
just a personal pref, idk.

Susan's suggestion of range("c22").value="" has failed me before.
I've had more luck with =Empty than ="", not sure why actually.