PDA

View Full Version : Need help with command button



Chuck31
11-20-2007, 10:01 AM
Hi all,

I'm a newbie in VBA, I'm trying to program a command button or a function that will fill in the empty cells in a specific range or row in my sheet by "-".


Thanks in advance for all your help.

lucas
11-20-2007, 10:14 AM
What is the specific range Chuck?

Chuck31
11-20-2007, 10:20 AM
Hey Steve,

D11 to AY47

But it has to be only on the active row.

lucas
11-20-2007, 10:29 AM
every cell in the row from D to AY that is blank?

Chuck31
11-20-2007, 10:31 AM
Yes.
Is it easier if I sent you my file ?

Chuck31
11-20-2007, 11:06 AM
Any help ??

Bob Phillips
11-20-2007, 11:31 AM
Public Sub ProcessData()
Dim cell As Range
For Each cell In Intersect(Rows(ActiveCell.Row), Range("D11:AY47"))
If cell.Value = "" Then cell.Value = "-"
Next cell
End Sub

Chuck31
11-20-2007, 11:37 AM
Thank you so much.:thumb

lucas
11-20-2007, 11:44 AM
I'm just too slow to keep up with Bob....

Chuck31
11-20-2007, 12:05 PM
Ah don't worry about it ;)
All your help has been great and very much appreciated.