Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |