If cell blank = $0.00?

EdaddyJ

Board Regular
Joined
Feb 14, 2007
Messages
115
Can you tell me whats wrong here? I know it has something to do with the range. Or give me a better solution?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Set rng = Sheets(1).Range("=D23:E304")
For Each cell In rng
If cell.Value = 0 Or cell.Value = Null Or cell.Value = " " Then
cell.Value = "$0.00"
End If
End Sub
 
Every 10 lines there is text so that won't work and every 10 lines there is a new absolute reference. So I can just write it 30 times. It will have to do.

Thanks for your help
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,216,175
Messages
6,129,305
Members
449,499
Latest member
HockeyBoi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top