ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   empty a entire row (https://www.excelbanter.com/excel-programming/343471-empty-entire-row.html)

bill gras

empty a entire row
 
I have formulas in cells in column "C" and when a formula returns a "0" (zero)
I need to empty (not delete) that entire row or rows what ever the case may
be,
from column "C,D,E,F" ect. on wards as far as it will go.
I need to have the rows in columns "A,B" untouched) there are 8000 rows
Can some one help me please
Thanks
regards bill
--
bill gras

Jim Thomlinson[_4_]

empty a entire row
 
Here is some code for you. Right click on the appropriate sheet tab and
select view code. Paste this in the code window and you should be good to
go...

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrorHandler
With Target
If .Column = 3 And .Value = 0 Then
Application.EnableEvents = False
Range(.Offset(0, 1), .Offset(0, Columns.Count - 3)).ClearContents
End If
End With
ErrorHandler:
Application.EnableEvents = True
End Sub

--
HTH...

Jim Thomlinson


"bill gras" wrote:

I have formulas in cells in column "C" and when a formula returns a "0" (zero)
I need to empty (not delete) that entire row or rows what ever the case may
be,
from column "C,D,E,F" ect. on wards as far as it will go.
I need to have the rows in columns "A,B" untouched) there are 8000 rows
Can some one help me please
Thanks
regards bill
--
bill gras


bill gras

empty a entire row
 
Hi Jim
Thank you for your reply and the explanation how to apply the code
Thanks again
regards bill
--
bill gras


"Jim Thomlinson" wrote:

Here is some code for you. Right click on the appropriate sheet tab and
select view code. Paste this in the code window and you should be good to
go...

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrorHandler
With Target
If .Column = 3 And .Value = 0 Then
Application.EnableEvents = False
Range(.Offset(0, 1), .Offset(0, Columns.Count - 3)).ClearContents
End If
End With
ErrorHandler:
Application.EnableEvents = True
End Sub

--
HTH...

Jim Thomlinson


"bill gras" wrote:

I have formulas in cells in column "C" and when a formula returns a "0" (zero)
I need to empty (not delete) that entire row or rows what ever the case may
be,
from column "C,D,E,F" ect. on wards as far as it will go.
I need to have the rows in columns "A,B" untouched) there are 8000 rows
Can some one help me please
Thanks
regards bill
--
bill gras


bill gras

empty a entire row
 
Hi Jim
I have enterd the macro as you adviced , but nothing happend
when I ran the macro
regards bill
--
bill gras


"Jim Thomlinson" wrote:

Here is some code for you. Right click on the appropriate sheet tab and
select view code. Paste this in the code window and you should be good to
go...

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrorHandler
With Target
If .Column = 3 And .Value = 0 Then
Application.EnableEvents = False
Range(.Offset(0, 1), .Offset(0, Columns.Count - 3)).ClearContents
End If
End With
ErrorHandler:
Application.EnableEvents = True
End Sub

--
HTH...

Jim Thomlinson


"bill gras" wrote:

I have formulas in cells in column "C" and when a formula returns a "0" (zero)
I need to empty (not delete) that entire row or rows what ever the case may
be,
from column "C,D,E,F" ect. on wards as far as it will go.
I need to have the rows in columns "A,B" untouched) there are 8000 rows
Can some one help me please
Thanks
regards bill
--
bill gras



All times are GMT +1. The time now is 10:11 AM.

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