Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Yvette
 
Posts: n/a
Default Deleting blank rows

Hi ppl,

After pasting and sorting say A1:F20 any blanks always end up top when using
an acsending sort.

How can I (using code) delete any blank rows.

TIA

Yvette


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Roger Govier
 
Posts: n/a
Default Deleting blank rows

Hi Yvette

If the "blank" rows are sorting to the top, then they are not blank but
contain spaces. Blank rows will automatically fall to the bottom of a
sorted list.
Try sorting descending first, then delete all rows below your data.
Then sort ascending again.

--
Regards

Roger Govier


"Yvette" wrote in message
...
Hi ppl,

After pasting and sorting say A1:F20 any blanks always end up top when
using an acsending sort.

How can I (using code) delete any blank rows.

TIA

Yvette



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Yvette
 
Posts: n/a
Default Deleting blank rows

Hi Roger

Thx for your reply, I got hold of some code but I can't seem to get it to
work, maybe you, or someone are familiar with it:

Dim R As Long
Dim C As Range
Dim Rng As Range

ScreenUpdate = False
Application.Calculation = xlCalculationManual

On Error GoTo EndMacro

If Selection.Rows.Count 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
For R = Rng.Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountA(Rng.Rows(R).E ntireRow) = 0 Then
Rng.Rows(R).EntireRow.Delete
End If
Next R

EndMacro:

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

In setting the (Rng) is that the Cell, eg A20, if not then how do I specify
the blank starting row I want to delete

TIA

Yvette

"Roger Govier" wrote in message
...
Hi Yvette

If the "blank" rows are sorting to the top, then they are not blank but
contain spaces. Blank rows will automatically fall to the bottom of a
sorted list.
Try sorting descending first, then delete all rows below your data.
Then sort ascending again.

--
Regards

Roger Govier


"Yvette" wrote in message
...
Hi ppl,

After pasting and sorting say A1:F20 any blanks always end up top when
using an acsending sort.

How can I (using code) delete any blank rows.

TIA

Yvette





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Roger Govier
 
Posts: n/a
Default Deleting blank rows

Hi Yvette

ScreenUpdate = False

should be Application.ScreenUpdating = False

You can either mark a range of rows before invoking the macro, or, if
not it will look at the whole used range on the sheet.
The macro examines each row starting from the last row found with data,
back to the beginning of the data range, and uses the COUNTA function to
determine if there are nay entries in the row. If there are not
(Counta=0) then it deletes that entire row.

--
Regards

Roger Govier


"Yvette" wrote in message
...
Hi Roger

Thx for your reply, I got hold of some code but I can't seem to get it
to work, maybe you, or someone are familiar with it:

Dim R As Long
Dim C As Range
Dim Rng As Range

ScreenUpdate = False
Application.Calculation = xlCalculationManual

On Error GoTo EndMacro

If Selection.Rows.Count 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
For R = Rng.Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountA(Rng.Rows(R).E ntireRow) = 0
Then
Rng.Rows(R).EntireRow.Delete
End If
Next R

EndMacro:

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

In setting the (Rng) is that the Cell, eg A20, if not then how do I
specify the blank starting row I want to delete

TIA

Yvette

"Roger Govier" wrote in message
...
Hi Yvette

If the "blank" rows are sorting to the top, then they are not blank
but contain spaces. Blank rows will automatically fall to the bottom
of a sorted list.
Try sorting descending first, then delete all rows below your data.
Then sort ascending again.

--
Regards

Roger Govier


"Yvette" wrote in message
...
Hi ppl,

After pasting and sorting say A1:F20 any blanks always end up top
when using an acsending sort.

How can I (using code) delete any blank rows.

TIA

Yvette







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
resetting last cell jagdish.eashwar Excel Discussion (Misc queries) 11 March 31st 06 02:06 AM
Hiding Rows Leaves Labels Blank Laura Excel Discussion (Misc queries) 3 March 24th 06 01:10 PM
Deleting Unique Rows MWS Excel Discussion (Misc queries) 1 March 21st 06 09:37 PM
Help!! I have problem deleting 2500 rows of filtered rows!!!! shirley_kee Excel Discussion (Misc queries) 1 January 12th 06 03:24 AM
Blank Rows Acesmith Excel Discussion (Misc queries) 1 November 30th 04 09:23 PM


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

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

About Us

"It's about Microsoft Excel"