ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make zeroes in Selection nothing "" (https://www.excelbanter.com/excel-programming/425360-make-zeroes-selection-nothing.html)

MikeF[_2_]

Make zeroes in Selection nothing ""
 

My code navigates to and selects a range, then needs to change all zeroes to
blanks, nothing, "" .

Is there a quick trick to this that I'll slap my forehead over?

Thanx,
- Mike

ryguy7272

Make zeroes in Selection nothing ""
 
This will do it for you:

Sub DelZeros()
For X = 1 To 1
Dim redRng As Range

Set redRng = Range("A1", Range("J100").End(xlUp))
For Each Cell In redRng

If Cell.Value = 0 Then
Cell.Value = ""
End If

Next Cell
Next X
End Sub

Remember to make a back of your Excel file, just in case the result
is...ummmm...unintended. It's a total PITA to try to recover lost data.

Also, notice the range, A1:J100. Change to suit your needs.

Regards,
Ryan---

--
RyGuy


"MikeF" wrote:


My code navigates to and selects a range, then needs to change all zeroes to
blanks, nothing, "" .

Is there a quick trick to this that I'll slap my forehead over?

Thanx,
- Mike


Dave Peterson

Make zeroes in Selection nothing ""
 
Are they values or formulas?

If they're values:

Select the range and then
edit|replace
what: 0
with: (leave blank)
replace all

Make sure you match entire cell constants.

Record a macro when you do it manually and you'll have the code.

MikeF wrote:

My code navigates to and selects a range, then needs to change all zeroes to
blanks, nothing, "" .

Is there a quick trick to this that I'll slap my forehead over?

Thanx,
- Mike


--

Dave Peterson


All times are GMT +1. The time now is 07:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com