Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

deleting rows from excel

Hi,
I have a large excel sheet, with some blank rows in different locations, i want to delete all of these, is this possible?

thanks
0
markmchugh
Asked:
markmchugh
1 Solution
 
BradB3030Commented:
Yes, you can use the Excel.Application object, you can loop through each row, check to see if there's information in specific cells...if not, you can delete it.

Example at home if you need it...
0
 
markmchughAuthor Commented:
please, can you post an example?
0
 
markmchughAuthor Commented:
got a solution.................. no need for anybody to post
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
markmchughAuthor Commented:
sorry, the solution does not work.... i've increased the points available
0
 
markmchughAuthor Commented:
ok, here is the solution i used, i used the following excel macro

Sub DeleteBlankRows1()
'Deletes the entire row within the selection if the ENTIRE row contains no data.

'We use Long in case they have over 32,767 rows selected.
Dim i As Long

      'We turn off calculation and screenupdating to speed up the macro.
      With Application
            .Calculation = xlCalculationManual
            .ScreenUpdating = False
     
      'We work backwards because we are deleting rows.
      For i = Selection.Rows.Count To 1 Step -1
            If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
                  Selection.Rows(i).EntireRow.Delete
            End If
      Next i

            .Calculation = xlCalculationAutomatic
            .ScreenUpdating = True
       End With
End Sub


to tun it

Open Excel.
Push Alt+F11 to open the VBE (Visual Basic Editor).
Go to Insert>Module.
Copy the code and paste it in the new module.
Push Alt+Q to return to Excels normal view.
Push Alt+F8 and then select the macro name and click Run. Or select Options and assign a shortcut key.


i got this from http://www.ozgrid.com/VBA/VBACode.htm

no need to comment further

thanks
0
 
YoukkoCommented:
So, if the solution is already found, what about closing this topic?
0
 
markmchughAuthor Commented:
how do i close?
0
 
YoukkoCommented:
I believe if you accept your own answer would do...
0
 
YoukkoCommented:
If not, ask a moderator..
0
 
CetusMODCommented:
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now