Thread: Formula for 0
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Formula for 0

Try the below macro. If you are new to macros set the Security level to
low/medium in (Tools|Macro|Security). From workbook launch VBE using
short-key Alt+F11. From menu 'Insert' a module and paste the below code.
Save. Get back to Workbook. Run macro from Tools|Macro|Run <selected macro()

Sub DeleteEmptyColumns()
For lngCol = Cells(1, Columns.Count).End(xlToLeft).Column To 1 Step -1
'Hide rows with zeros and blanks
If WorksheetFunction.CountIf(Columns(lngCol), 0) + _
WorksheetFunction.CountBlank(Columns(lngCol)) = _
Rows.Count Then Columns(lngCol).Delete
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Fareez" wrote:

Dear Friends
I want to find out 0 value and delete that columns say for ex
45862 0 46502 0 47449 0 48002 0
in this example i want to delete all columns which is 0 value.

thanks in advance