0
   

How to eliminate blank rows from a worksheet using VBA code?

 
 
Reply Fri 1 Jul, 2016 03:59 am
Hello everyone, I am a regular user of Microsoft Excel with VBA and have a very good understanding of the program. However, in my latest worksheet, I have stumbled upon an irritating issue, which I can’t seem to resolve. I have a worksheet that consist of over 10,000 rows of data. But the sheet also has many blank rows at random places which I need to eliminate. I have tried every formula and function I can think of but none worked. I was hoping I could find the necessary VBA code here, so if anyone can, please help me to delete all the blank rows from my worksheet with the help of VBA code.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 0 • Views: 1,483 • Replies: 2
No top replies

 
engineer
 
  2  
Reply Fri 1 Jul, 2016 04:48 am
@arbindgaba,
If you sort the data on any field, the blanks will drop to the bottom. I would try that before going the VBA route.
engineer
 
  2  
Reply Fri 1 Jul, 2016 06:18 am
@engineer,
If you want to use VBA, you could use this. Be sure to put the work "stop" in column A at the end and save a copy in case it doesn't work the way you want.

Code:Public Sub DeleteEmptyRows()

Range("a1").Select
Do While ActiveCell.Value <> "stop"
If ActiveCell.Value = Empty Then
Rows(ActiveCell.Row).Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
End Sub
0 Replies
 
 

Related Topics

 
  1. Forums
  2. » How to eliminate blank rows from a worksheet using VBA code?
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.06 seconds on 11/14/2024 at 08:28:55