Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Fill in the blanks!

Hi All,

I have a range of cells (i.e. A1:D5), some cells contain values and others
are blank cells.

I want to create a piece of code that checks each cell in the range. If a
cell is blank is blank then insert a 0, and if a cell contains a value then
ignore it and move onto the next cell.

Can anyone help at all?

Many thanks,

Pinda.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Fill in the blanks!

This runs off any range you select:

Sub Macro1()
Dim r As Range
For Each r In Selection
If IsEmpty(r.Value) Then
r.Value = 0
End If
Next
End Sub


--
Gary''s Student


"Bhupinder Rayat" wrote:

Hi All,

I have a range of cells (i.e. A1:D5), some cells contain values and others
are blank cells.

I want to create a piece of code that checks each cell in the range. If a
cell is blank is blank then insert a 0, and if a cell contains a value then
ignore it and move onto the next cell.

Can anyone help at all?

Many thanks,

Pinda.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Fill in the blanks!

works a treat, thank you

Apologies for the repeated thread, I wasn't getting the prompt box to say my
message had been posted.

Thanks again,

Pinda.

"Gary''s Student" wrote:

This runs off any range you select:

Sub Macro1()
Dim r As Range
For Each r In Selection
If IsEmpty(r.Value) Then
r.Value = 0
End If
Next
End Sub


--
Gary''s Student


"Bhupinder Rayat" wrote:

Hi All,

I have a range of cells (i.e. A1:D5), some cells contain values and others
are blank cells.

I want to create a piece of code that checks each cell in the range. If a
cell is blank is blank then insert a 0, and if a cell contains a value then
ignore it and move onto the next cell.

Can anyone help at all?

Many thanks,

Pinda.

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
How to fill up blanks deeds Excel Discussion (Misc queries) 4 October 13th 09 05:52 PM
Fill in the blanks! Bhupinder Rayat Excel Programming 2 March 2nd 06 04:47 PM
Fill in the blanks!! Bhupinder Rayat Excel Programming 1 March 2nd 06 04:33 PM
Fill in the blanks BOB Excel Programming 1 January 31st 05 06:21 PM
Fill in the blanks Jim Thomlinson[_3_] Excel Programming 0 January 31st 05 06:16 PM


All times are GMT +1. The time now is 12:42 AM.

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

About Us

"It's about Microsoft Excel"