Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default cells with null or no data

I have code that I have tried in various ways yet I can not get the code to
recognize a blank cell.
For z1 = 7 To 1300
If Cells(z1, 9) = "" Then Cells(z1, 10) = "HI"
If IsNull(Cells(z1, 9)) = True Then Cells(z1, 10) = "HI"
Next z1

I only used the word hi to stick out on the sheet.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default cells with null or no data

Are you sure the cells are empty. A cell may be "false empty" if it contains
a space character.

Try this:

For z1 = 7 To 1300
If Trim(Cells(z1, 9)) = "" Then Cells(z1, 10) = "HI"
If IsNull(Cells(z1, 9)) = True Then Cells(z1, 10) = "HI"
Next z1

Regards,
Per

"Rpettis31" skrev i meddelelsen
...
I have code that I have tried in various ways yet I can not get the code to
recognize a blank cell.
For z1 = 7 To 1300
If Cells(z1, 9) = "" Then Cells(z1, 10) = "HI"
If IsNull(Cells(z1, 9)) = True Then Cells(z1, 10) = "HI"
Next z1

I only used the word hi to stick out on the sheet.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default cells with null or no data

On Nov 13, 3:31*pm, Rpettis31
wrote:
I have code that I have tried in various ways yet I can not get the code to
recognize a blank cell.
* For z1 = 7 To 1300
* * * * If Cells(z1, 9) = "" Then Cells(z1, 10) = "HI"
* * * * If IsNull(Cells(z1, 9)) = True Then Cells(z1, 10) = "HI"
* * Next z1

I only used the word hi to stick out on the sheet.


Instead of using If Cells(z1, 9) = "", use If IsEmpty(Cells(Z1,9)).
This will truly check for an empty cell. Doing it the other way can
result in cells looking like they are blank but are filled with spaces.
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
Failed to save table attributes of (null) into (null). Luca Brasi Excel Discussion (Misc queries) 2 February 4th 09 04:30 PM
EXCEL Spreadsheet CELLS have data but load as NULL ITContractor Excel Programming 4 January 11th 08 08:26 AM
Generating blank or null cells that the Histogram Data Analysis tool will ignore [email protected] Excel Worksheet Functions 2 June 12th 07 09:13 PM
NULL Cells UnderCoverGuy Excel Worksheet Functions 4 October 31st 06 07:33 PM
Cells().value is null but I can see data JohnEnnever Excel Programming 1 January 8th 04 02:04 AM


All times are GMT +1. The time now is 09:14 AM.

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"