Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default deleting values from a column

I have a column of values and from time to time I have “0”. How can
erase these values of “0” but without leaving blank cells in the colum
and thus get a column with only the positive values in also in the sam
order? I would like to know if there is a macro for this!?

Dan


--
Message posted from
http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default deleting values from a column

Hi

Try this one for column A

Sub Example1()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

Firstrow = ActiveSheet.UsedRange.Cells(1).Row
Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1
With ActiveSheet
.DisplayPageBreaks = False
For Lrow = Lastrow To Firstrow Step -1
If IsError(.Cells(Lrow, "A").Value) Then
'Do nothing, This avoid a error if there is a error in the cell

ElseIf .Cells(Lrow, "A").Value = "0" Then .Rows(Lrow).Delete

End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub

More delete examples you find here
http://www.rondebruin.nl/delete.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl


"cdanu " wrote in message ...
I have a column of values and from time to time I have "0". How can I
erase these values of "0" but without leaving blank cells in the column
and thus get a column with only the positive values in also in the same
order? I would like to know if there is a macro for this!?

Dan



---
Message posted from
http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting values less than 100 PointerMan Excel Worksheet Functions 3 May 17th 23 11:44 AM
Deleting Unique Values RK Excel Discussion (Misc queries) 2 March 17th 10 12:15 PM
Deleting rows based on column values Dazed and Confused[_2_] New Users to Excel 3 February 6th 09 10:47 PM
deleting values in a worksheet without deleting the formulas patti Excel Worksheet Functions 1 October 28th 05 09:49 PM
Repeat values, deleting? SteW Charts and Charting in Excel 1 April 29th 05 01:12 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"