Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Identifying blank rows

Dear All,

I am faced with a tough situation due to which I am not
able to make a file presentable. For reporting purpose I
have to download files from my office system in excel.
But the problem is that on downloading the system creates
lots of blank rows in the excel file. Now the size of the
download varies every time and also the number of blank
rows between 2 records is not fixed. To counter this I
wish to generate a macro which would identify the blank
rows in the file and delete it automatically.

If anyone has a solution to this kindly let me know the
macro for the same. Thanking you all for the support.

Regards,
Raj

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Identifying blank rows

That's the macro code you need mate:

Sub DeleteEmptyRows()
LastRow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For r = LastRow To 1 Step -1
If Application.CountA(Rows(r)) = 0 Then Rows
(r).Delete
Next r
End Sub

-----Original Message-----
Dear All,

I am faced with a tough situation due to which I am not
able to make a file presentable. For reporting purpose I
have to download files from my office system in excel.
But the problem is that on downloading the system creates
lots of blank rows in the excel file. Now the size of the
download varies every time and also the number of blank
rows between 2 records is not fixed. To counter this I
wish to generate a macro which would identify the blank
rows in the file and delete it automatically.

If anyone has a solution to this kindly let me know the
macro for the same. Thanking you all for the support.

Regards,
Raj

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
raj raj is offline
external usenet poster
 
Posts: 32
Default Identifying blank rows

Hi

It works fine. Thank you so much for the much needed
support. But would you tell me what does this line mean
actually.
Application.CountA(Rows(r))

Regards
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Identifying blank rows

AN alternative without looping

Sub DeleteRows()
Application.ScreenUpdating = False
With ActiveSheet
.Range("A1").EntireRow.Insert
.Range("A1").FormulaR1C1 = "Test"
.Columns("A:A").AutoFilter Field:=1, Criteria1:="="
.Cells.SpecialCells(xlCellTypeVisible).EntireRow.D elete
.Rows("1:1").Delete Shift:=xlUp
End With
Application.ScreenUpdating = True
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Serkan" wrote in message
...
That's the macro code you need mate:

Sub DeleteEmptyRows()
LastRow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For r = LastRow To 1 Step -1
If Application.CountA(Rows(r)) = 0 Then Rows
(r).Delete
Next r
End Sub

-----Original Message-----
Dear All,

I am faced with a tough situation due to which I am not
able to make a file presentable. For reporting purpose I
have to download files from my office system in excel.
But the problem is that on downloading the system creates
lots of blank rows in the excel file. Now the size of the
download varies every time and also the number of blank
rows between 2 records is not fixed. To counter this I
wish to generate a macro which would identify the blank
rows in the file and delete it automatically.

If anyone has a solution to this kindly let me know the
macro for the same. Thanking you all for the support.

Regards,
Raj

.



  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Identifying blank rows

It uses the Counta() worksheet function which counts non-
empty cells in VB by adding application. in front of it.
-----Original Message-----
Hi

It works fine. Thank you so much for the much needed
support. But would you tell me what does this line mean
actually.
Application.CountA(Rows(r))

Regards
.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Identifying blank rows

It counts the number of non-blank cells in the row pointed at by the
variable r.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Raj" wrote in message
...
Hi

It works fine. Thank you so much for the much needed
support. But would you tell me what does this line mean
actually.
Application.CountA(Rows(r))

Regards



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
tabs identifying columns and rows George Excel Discussion (Misc queries) 2 April 18th 10 04:06 AM
Identifying non-returning formula (blank Cell) Vibeke Excel Worksheet Functions 9 September 4th 09 09:29 AM
Identifying duplicate rows TBA Excel Discussion (Misc queries) 2 June 15th 07 09:38 AM
Identifying first non blank cell in 3 different columns belvy123 Excel Discussion (Misc queries) 5 February 21st 07 06:36 AM
Identifying exact values in alternate rows YG Excel Worksheet Functions 1 November 2nd 04 11:25 PM


All times are GMT +1. The time now is 05:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"