Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help: How do I fill a column with values if it is blank?


Hello,

How do I fill a column of cells with values if it is empty? I want to
fill empty cells with a 0 (zero). The tricky part is, the cells should
only be filled if they are in a row. For instance, A25 has data in it,
but B25 doesn't, but some cells in column b has value, so b25 needs to
have a zero in it since it is in row 25.

I'm not sure how to approach this.

Thanks!


--
limshady411
------------------------------------------------------------------------
limshady411's Profile: http://www.excelforum.com/member.php...o&userid=28711
View this thread: http://www.excelforum.com/showthread...hreadid=484111

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Help: How do I fill a column with values if it is blank?

Wild guess:

Sub BVals()
Dim eRow As Long
Dim ColB As Range
Dim cell As Range
eRow = Cells(Rows.Count, 1).End(xlUp).Row
Set ColB = Range(Cells(2, 2), Cells(eRow, 2))
For Each cell In ColB
If cell.Offset(0, -1).Value < Empty _
And cell.Value = Empty Then cell.Value = 0
Next cell
End Sub

Hopet this helps
Rowan

limshady411 wrote:
Hello,

How do I fill a column of cells with values if it is empty? I want to
fill empty cells with a 0 (zero). The tricky part is, the cells should
only be filled if they are in a row. For instance, A25 has data in it,
but B25 doesn't, but some cells in column b has value, so b25 needs to
have a zero in it since it is in row 25.

I'm not sure how to approach this.

Thanks!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help: How do I fill a column with values if it is blank?


Thanks...this didn't work, but good try. I guess maybe, all I need i
to make sure that in the last row of a spreadsheet, if it is an empt
cell, make it a 0. This might be easier. Any ideas? Thanks everyone

--
limshady41
-----------------------------------------------------------------------
limshady411's Profile: http://www.excelforum.com/member.php...fo&userid=2871
View this thread: http://www.excelforum.com/showthread.php?threadid=48411

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Help: How do I fill a column with values if it is blank?

It is still not all that clear what you are after so if this doesn't
work try to give a more detailed explanation of what it is you want to
achieve. This assumes you have data in column A. It checks the last cell
in Column B and if this is empty inserts a 0:

Sub lrow()
Dim eRow As Long
eRow = Cells(Rows.Count, 1).End(xlUp).Row
With Cells(eRow, 2)
If .Value = Empty Then .Value = 0
End With
End Sub

Regards
Rowan

limshady411 wrote:
Thanks...this didn't work, but good try. I guess maybe, all I need is
to make sure that in the last row of a spreadsheet, if it is an empty
cell, make it a 0. This might be easier. Any ideas? Thanks everyone.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help: How do I fill a column with values if it is blank?


Thanks for your help. I can make it simpler. I want to fill all cells in
a row with a value of zero. How would I go about this? Thanks again!


--
limshady411
------------------------------------------------------------------------
limshady411's Profile: http://www.excelforum.com/member.php...o&userid=28711
View this thread: http://www.excelforum.com/showthread...hreadid=484111



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
Auto fill values with a blank row formatting between entries Excel Autofill Excel Discussion (Misc queries) 7 August 22nd 09 04:09 AM
fill blank cells in a column Luís Miguel Ramires Vieira Reis RAM Excel Worksheet Functions 1 November 18th 08 01:06 PM
Fill blank values Joe Excel Discussion (Misc queries) 2 October 24th 06 01:21 PM
Fill column blanks from last non-blank cell C. BROWN Excel Discussion (Misc queries) 2 August 28th 06 08:36 PM
how can i fill blank cells in column with abc while the right col. khurram saddique Excel Discussion (Misc queries) 2 February 12th 05 03:25 PM


All times are GMT +1. The time now is 09:30 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"