View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Dave Birley Dave Birley is offline
external usenet poster
 
Posts: 171
Default Macro only "Works" with F-8

Odd -- those extra variables were the result of me starting by hacking
another Macro and just stealing its first 10 lines or so, then not being
careful with my "housekeeping". As the number of Rows involved was very small
(<200), I just held my finger down on the F8 key and did the dirty deed.
However I shall hang on to your tweak for future reference. Thanks for the
help!
--
Dave
Temping with Staffmark
in Rock Hill, SC


"JW" wrote:

Works fine for me when I run it. There isn't a need to select the
cells though. Depending on the size of your data, that could make a
slight impact in runtime. Also, you have 3 variables declared that
you aren't using. There is probably a reason for this, but thought
I'd mention it anyhow. Here is some tweaked code without the cell
selection.
Sub DeleteBlanksInColumnA()
Dim rngCell, rngNewCell As Range
Dim varName, varCount As Variant
varCount = 1
Sheets("Names by Category").Select
With Range("A2", Range("A" & Rows.Count).End(xlUp))
For Each rngCell In .Cells
If IsEmpty(rngCell(1, 1)) Then _
rngCell(1, 1).Delete Shift:=xlUp
Next rngCell
End With
End Sub

HTH

Dave Birley wrote:
Here's the Macro:

Sub DeleteBlanksInColumnA()
'
' Macro1 Macro
' Macro recorded 5/17/2007 by Administrator
'
Dim rngCell, rngNewCell As Range
Dim varName, varCount As Variant

varCount = 1
Sheets("Names by Category").Select
With Range("A2", Range("A" & Rows.Count).End(xlUp))
For Each rngCell In .Cells
If IsEmpty(rngCell(1, 1)) Then
rngCell(1, 1).Select
Selection.Delete Shift:=xlUp
End If
Next rngCell
End With
End Sub

When I step through it with the F8 key, it does what I expect it to do. When
I turn it loose with Run, it don't do nuffin'!

Whutz goin' on here?
--
Dave
Temping with Staffmark
in Rock Hill, SC