Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delete blank rows sub

Posted on 2011-03-14
4
Medium Priority
?
197 Views
Last Modified: 2012-05-11
Hi,

I have attached a ss where i want a piece of code that can count until the last row using ColA and then delete any blank rows (there is formula in the blank rows)

See attached

Thanks
Seamus
test1.xls
0
Comment
Question by:Seamus2626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 2000 total points
ID: 35127183
Something like:
Sub TidyUp()
   With Sheets("Sheet1")
    .Range("A1").CurrentRegion.Sort Key1:=.Range("A2"), Order1:=xlAscending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
      .Range(.Cells(.Rows.Count, "A").End(xlUp).Offset(1), .Cells.SpecialCells(xlCellTypeLastCell)).Clear
   End With
End Sub

Open in new window

0
 

Author Closing Comment

by:Seamus2626
ID: 35127190
Magic

Thanks Rory

Seamus
0
 
LVL 6

Expert Comment

by:Russell Lucas
ID: 35127214
Just as an alternative solution:-


Sub Remove_Blanks()
Dim i As Integer
i = 2
While ExitCondition = False
    If Sheet1.Range("I" & i).Formula = "" Then ExitCondition = True
    If Sheet1.Range("A" & i).Value = "" Then
        Sheet1.Rows(i).Delete
    Else
        i = i + 1
    End If
Wend
End Sub

Open in new window

0
 

Author Comment

by:Seamus2626
ID: 35146362
Thanks Funinig_Stroll, appreciate the additional info

Cheers,
Seamus
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question