Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Define Range in Deleting Empty Rows

Hi,
Am using the following code to remove empty rows. How can i set th
rows to be checked eg. A15:A2500


Sub DeleteBlankRows1()

Dim i As Long

With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False

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


thanks,
Hamis

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Define Range in Deleting Empty Rows

If you know the range:

Option Explicit
Sub DeleteBlankRows1A()

Dim i As Long
Dim rng As Range

Set rng = ActiveSheet.Range("a15:a2500") ' or Selection

With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False

For i = rng.Rows.Count To 1 Step -1
If WorksheetFunction.CountA(rng.Rows(i)) = 0 Then
rng.Rows(i).EntireRow.Delete
End If
Next i

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



HamishM wrote:

Hi,
Am using the following code to remove empty rows. How can i set the
rows to be checked eg. A15:A2500

Sub DeleteBlankRows1()

Dim i As Long

With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False

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

thanks,
Hamish

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

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
Deleting empty rows Felix New Users to Excel 1 February 3rd 09 07:48 AM
Deleting Rows Between Empty Cells Daren Excel Worksheet Functions 6 September 8th 08 04:19 PM
deleting empty rows EngelseBoer Excel Discussion (Misc queries) 3 September 7th 08 01:09 AM
Deleting empty rows automatically Bigweed Excel Discussion (Misc queries) 2 September 13th 06 09:39 PM
Deleting All Empty Rows bodhisatvaofboogie Excel Discussion (Misc queries) 3 May 18th 06 12:36 PM


All times are GMT +1. The time now is 10:22 PM.

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"