ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete all cells in range matching certain values (https://www.excelbanter.com/excel-programming/395376-delete-all-cells-range-matching-certain-values.html)

Tommy[_4_]

Delete all cells in range matching certain values
 
I have a range selected dynamically using this: Range(Cells(4, 3),
Cells(4, 3).End(xlDown)).Select

Within the range is a list of strings.However some of the cells
contain the value "0". I would like to be able to sort through the
selected range and delete the value 0 from the cells containing this
value so that I end up with just a blank, clear cell in its place. The
reason for this is that the range eventually gets sorted for non-empty
cells so I need the 0 removed if present. How would I go about this
using VBA?

Regards,

Tom


Bob Phillips

Delete all cells in range matching certain values
 
For Each cell In Range(Cells(4, 3),Cells(4, 3).End(xlDown))
If Cell.Value = 0 Then cell.Value =""
Next cell

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Tommy" wrote in message
ups.com...
I have a range selected dynamically using this: Range(Cells(4, 3),
Cells(4, 3).End(xlDown)).Select

Within the range is a list of strings.However some of the cells
contain the value "0". I would like to be able to sort through the
selected range and delete the value 0 from the cells containing this
value so that I end up with just a blank, clear cell in its place. The
reason for this is that the range eventually gets sorted for non-empty
cells so I need the 0 removed if present. How would I go about this
using VBA?

Regards,

Tom




Tommy[_4_]

Delete all cells in range matching certain values
 
On 13 Aug, 15:45, "Bob Phillips" wrote:
For Each cell In Range(Cells(4, 3),Cells(4, 3).End(xlDown))
If Cell.Value = 0 Then cell.Value =""
Next cell

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Tommy" wrote in message

ups.com...



I have a range selected dynamically using this: Range(Cells(4, 3),
Cells(4, 3).End(xlDown)).Select


Within the range is a list of strings.However some of the cells
contain the value "0". I would like to be able to sort through the
selected range and delete the value 0 from the cells containing this
value so that I end up with just a blank, clear cell in its place. The
reason for this is that the range eventually gets sorted for non-empty
cells so I need the 0 removed if present. How would I go about this
using VBA?


Regards,


Tom- Hide quoted text -


- Show quoted text -


gracias



All times are GMT +1. The time now is 08:54 AM.

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