View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
KelliInCali KelliInCali is offline
external usenet poster
 
Posts: 37
Default run-time error 1004

Thanks for the suggestion Bill... This doesn't seem to work for me, probably
because I don't know how to properly insert your code. But I think I need to
consolidate some of what I'm doing anyway. I think I have figured out a
better way, but now I need to know something else, if you don't mind
continuing with this:

How do I "fill down" a formula in a column based not on an absolute row
range but on the last used row of a different column? I've tried every
syntax I can think of but can't make it work.

Basically, I want to fill down from "O1", with the last row being equivalent
to the last used row in "A".

tia,
kelli




"Bill Renaud" wrote:

Try a technique like this:
Step through the code to verify that it works the way you want it.

'----------------------------------------------------------------------
'rngData is a column of cells in a list of data,
'not including the header.

Sub DeleteMarkedRows(rngData As Range)
Dim rngCell As Range
Dim rngMarkedCells As Range

'Copy and paste special to eliminate the formulas.
'They should now contain constants (i.e. "Delete", etc.),
'without having to do an Application.Calculate statement.
With rngData
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
Application.CutCopyMode = False

'Now clear the cells that have a non-blank string in them.
For Each rngCell In rngData
With rngCell
If .Value = "" Then .ClearContents
End With
Next rngCell

'Now locate all of the marked cells, and delete only those rows.
Set rngMarkedCells = rngData.SpecialCells(xlCellTypeConstants)
rngMarkedCells.EntireRow.Delete
End Sub

--
Regards,
Bill Renaud