Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Need help with a macro

I'm sure someone out there has a macro to do this, so here goes.
I need to put zeros in cells which have no data in them within a
specified range and do nothing to cells which have a value in them.
Here is the problem... I need the macro to ask me to input that
specified range each time I run the macro. I hope that someone out
there can help me out. I'm pretty much a novice on macro programming
and could use some help here.

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Need help with a macro

Aaron

Sub Add_Zero()
Dim cel As Range
Dim sRange As Range
Set sRange = Application.InputBox(prompt:= _
"Select the range of cells.", Type:=8)
For Each cel In sRange
If cel.Value = "" Then
cel.Value = 0
End If
Next
End Sub

Note: you can select the range with the Mouse or type the range into the box.

Gord Dibben Excel MVP

On 4 Feb 2004 17:56:18 -0800, (Aaron Cooper) wrote:

I'm sure someone out there has a macro to do this, so here goes.
I need to put zeros in cells which have no data in them within a
specified range and do nothing to cells which have a value in them.
Here is the problem... I need the macro to ask me to input that
specified range each time I run the macro. I hope that someone out
there can help me out. I'm pretty much a novice on macro programming
and could use some help here.

Thanks in advance.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Need help with a macro

Thank you all so much. You've saved me hours. There is no way that
you could comprehend the amount of time that you have saved me from
either trying to figure this out on my own or filling all of the cells
in manually.

Thanks again,

Aaron
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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 05:15 PM.

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"