![]() |
macro to delete zeros and formulas
Hi
I have in sheet 2 in column " E " numbers starting at row 3 down to row 1500 , some cells are empty (no numbers , no formulas ) where ever there is an empty cell in column " E " I need to have in the same row the zero deleted in column " G " and the formula deleted in column " L" (both empty nothing in the cell ) If any one can help me , could you let me know how to activate the macro , I'm no good with macros Thanking you all in advance -- bill gras |
macro to delete zeros and formulas
Bill
I'd start this by saying you don't need a macro, you could in column E apply autofilter (DataAutofilter) and filter on blanks, then highlight column G and L in the filtered data and press the delete key. You could replicate this in a macro or as below, iterate the range and do it that way, for the number of cells you have it shouldn't take to long Sub cleardata() Dim myCell As Range For Each myCell In Worksheets("Sheet2").Range("E3:E1500") If myCell.Value = "" Then myCell.Offset(0, 2).Clear myCell.Offset(0, 7).Clear End If Next myCell End Sub -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England www.nickhodge.co.uk HIS "bill gras" wrote in message ... Hi I have in sheet 2 in column " E " numbers starting at row 3 down to row 1500 , some cells are empty (no numbers , no formulas ) where ever there is an empty cell in column " E " I need to have in the same row the zero deleted in column " G " and the formula deleted in column " L" (both empty nothing in the cell ) If any one can help me , could you let me know how to activate the macro , I'm no good with macros Thanking you all in advance -- bill gras |
macro to delete zeros and formulas
Hi Nick Hodge
You are a gentleman Thank you very much !!! regards bill gras -- bill gras "Nick Hodge" wrote: Bill I'd start this by saying you don't need a macro, you could in column E apply autofilter (DataAutofilter) and filter on blanks, then highlight column G and L in the filtered data and press the delete key. You could replicate this in a macro or as below, iterate the range and do it that way, for the number of cells you have it shouldn't take to long Sub cleardata() Dim myCell As Range For Each myCell In Worksheets("Sheet2").Range("E3:E1500") If myCell.Value = "" Then myCell.Offset(0, 2).Clear myCell.Offset(0, 7).Clear End If Next myCell End Sub -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England www.nickhodge.co.uk HIS "bill gras" wrote in message ... Hi I have in sheet 2 in column " E " numbers starting at row 3 down to row 1500 , some cells are empty (no numbers , no formulas ) where ever there is an empty cell in column " E " I need to have in the same row the zero deleted in column " G " and the formula deleted in column " L" (both empty nothing in the cell ) If any one can help me , could you let me know how to activate the macro , I'm no good with macros Thanking you all in advance -- bill gras |
All times are GMT +1. The time now is 07:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com