View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Mike Mike is offline
external usenet poster
 
Posts: 3,101
Default macro and deleting or hiding columns

Would you like to delete/hide any particular rows/columns? What is your
criteria for deleting/hiding?

The macro below will delete all blank rows in a selected range, is that any
good?

Sub Deleteblankrows()
Dim Rw As Range
If WorksheetFunction.CountA(Selection) = 0 Then
MsgBox "You didn't select a range", vbOKOnly
Exit Sub
End If
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
Selection.SpecialCells(xlCellTypeBlanks).Select
For Each Rw In Selection.Rows
If WorksheetFunction.CountA(Selection.EntireRow) = 0 Then
Selection.EntireRow.Delete
End If
Next Rw
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub

Mike

"Pascale" wrote:

Hello
I have done very basic macros using "tools" and "record new macro". I need
to create one that will delete some columns and hide others. How can I do
this please?
Many thanks. I am working on excel 2003.