Blank Cells in A Range default to O? - Clarification

kotting

New Member
Joined
Mar 18, 2002
Messages
17
Here is the code I currently use to fit my situation. It seems very repititious. There is probably an easier way to do this but this is the only way I have found that will work.

I have used the "Edit GoTo Special Blanks" method without success. So here it is - my masterpiece!

If Range("E42").Value < 1 Then
Range("E42").Value = "=0"
End If
If Range("g42").Value < 1 Then
Range("g42").Value = "=0"
End If
If Range("i42").Value < 1 Then
Range("i42").Value = "=0"
End If
If Range("k42").Value < 1 Then
Range("k42").Value = "=0"
End If
If Range("m42").Value < 1 Then
Range("m42").Value = "=0"
End If
If Range("o42").Value < 1 Then
Range("o42").Value = "=0"
End If
If Range("q42").Value < 1 Then
Range("q42").Value = "=0"
End If
If Range("s42").Value < 1 Then
Range("s42").Value = "=0"
End If
If Range("u42").Value < 1 Then
Range("u42").Value = "=0"
End If
If Range("w42").Value < 1 Then
Range("w42").Value = "=0"
End If
If Range("y42").Value < 1 Then
Range("y42").Value = "=0"
End If
If Range("aa42").Value < 1 Then
Range("aa42").Value = "=0"
End If
If Range("ac42").Value < 1 Then
Range("ac42").Value = "=0"
End If
If Range("aE42").Value < 1 Then
Range("aE42").Value = "=0"
End If
If Range("ag42").Value < 1 Then
Range("ag42").Value = "=0"
End If
If Range("AI42").Value < 1 Then
Range("ai42").Value = "=0"
End If
If Range("Ak42").Value < 1 Then
Range("ak42").Value = "=0"
End If
If Range("Am42").Value < 1 Then
Range("am42").Value = "=0"
End If
If Range("Ao42").Value < 1 Then
Range("ao42").Value = "=0"
End If
If Range("Aq42").Value < 1 Then
Range("aq42").Value = "=0"
End If
If Range("As42").Value < 1 Then
Range("as42").Value = "=0"
End If
If Range("Au42").Value < 1 Then
Range("au42").Value = "=0"
End If
If Range("Aw42").Value < 1 Then
Range("aw42").Value = "=0"
End If
If Range("Ay42").Value < 1 Then
Range("ay42").Value = "=0"
End If
If Range("BA42").Value < 1 Then
Range("BA42").Value = "=0"
End If
If Range("BC42").Value < 1 Then
Range("BC42").Value = "=0"
End If
If Range("Be42").Value < 1 Then
Range("Be42").Value = "=0"
End If
If Range("Bg42").Value < 1 Then
Range("Bg42").Value = "=0"
End If
If Range("Bi42").Value < 1 Then
Range("Bi42").Value = "=0"
End If
If Range("Bk42").Value < 1 Then
Range("Bk42").Value = "=0"
End If

End Sub

Thanks for any help anyone may have to offer - this runs on a spreadsheet where people enter numbers and text. I want it to update as entries are made so I Call this Procedure from my Workheet.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
This should accomplish the same thing...<pre>

Dim cCol
For cCol = 5 To 59 Step 2
If Cells(42, cCol).Value< 1 Then _
Cells(42, cCol).Value = 0
Next</pre>

if you don't want the 0 and want to leave it blank then use this:<pre>

Dim cCol
For cCol = 5 To 59 Step 2
If Cells(42, cCol).Value< 1 Then _
Cells(42, cCol).Value = ""
Next</pre>
This message was edited by TsTom on 2002-04-26 04:42
 
Upvote 0
Thanks for the help. I really need the 0. That was the whole point of this! Nice to have somewhere to go for help - what a lifesaver.
 
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,249
Members
448,556
Latest member
peterhess2002

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