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. |
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. |
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 |
All times are GMT +1. The time now is 02:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com