Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 304
Default Delete row with no data

I'm looking to delete rows that have no data from A106:I205. This will always
be a fixed spot.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Delete row with no data

See
http://www.rondebruin.nl/delete.htm

Try

Sub Loop_Example()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

'We use the ActiveSheet but you can replace this with
'Sheets("MySheet")if you want
With ActiveSheet

'We select the sheet so we can change the window view
.Select

'If you are in Page Break Preview Or Page Layout view go
'back to normal view, we do this for speed
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

'Turn off Page Breaks, we do this for speed
.DisplayPageBreaks = False

'Set the first and last row to loop through
Firstrow = 106
Lastrow = 205

'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1

If Application.CountA(.Range(.Cells(Lrow, "A"), .Cells(Lrow, "I"))) = 0 _
Then .Rows(Lrow).Delete
'This will delete the row if the A-I cells in the row are empty

Next Lrow

End With

ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"pgarcia" wrote in message ...
I'm looking to delete rows that have no data from A106:I205. This will always
be a fixed spot.

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 304
Default Delete row with no data

Sorry, then delete rows with no data in A18:G100.
Thanks

"pgarcia" wrote:

I'm looking to delete rows that have no data from A106:I205. This will always
be a fixed spot.

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Delete row with no data

Public Sub ProcessData()
Dim i As Long

With ActiveSheet

For i = 205 To 106 Step -1

If Application.CountA(.Cells(i, "A").Resize(, 9)) = 0 Then

.Rows(i).Delete
End If
Next i
End With

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"pgarcia" wrote in message
...
I'm looking to delete rows that have no data from A106:I205. This will
always
be a fixed spot.

Thanks.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Delete row with no data

maybe something like this

Sub test()

Dim c As Range
Dim rngDelete As Range

For Each c In ActiveSheet.Range("A106:A205")
If WorksheetFunction.CountA(c.Resize(1, 9)) = 0 Then
If rngDelete Is Nothing Then
Set rngDelete = c.EntireRow
Else
Set rngDelete = Union(rngDelete, c.EntireRow)
End If
End If
Next c

If Not rngDelete Is Nothing Then rngDelete.Delete


End Sub


--
Hope that helps.

Vergel Adriano


"pgarcia" wrote:

I'm looking to delete rows that have no data from A106:I205. This will always
be a fixed spot.

Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 304
Default Delete row with no data

Thanks, but it did not work.

"Ron de Bruin" wrote:

See
http://www.rondebruin.nl/delete.htm

Try

Sub Loop_Example()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

'We use the ActiveSheet but you can replace this with
'Sheets("MySheet")if you want
With ActiveSheet

'We select the sheet so we can change the window view
.Select

'If you are in Page Break Preview Or Page Layout view go
'back to normal view, we do this for speed
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

'Turn off Page Breaks, we do this for speed
.DisplayPageBreaks = False

'Set the first and last row to loop through
Firstrow = 106
Lastrow = 205

'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1

If Application.CountA(.Range(.Cells(Lrow, "A"), .Cells(Lrow, "I"))) = 0 _
Then .Rows(Lrow).Delete
'This will delete the row if the A-I cells in the row are empty

Next Lrow

End With

ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"pgarcia" wrote in message ...
I'm looking to delete rows that have no data from A106:I205. This will always
be a fixed spot.

Thanks.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 304
Default Delete row with no data

Thanks, but that also did not work.

"Bob Phillips" wrote:

Public Sub ProcessData()
Dim i As Long

With ActiveSheet

For i = 205 To 106 Step -1

If Application.CountA(.Cells(i, "A").Resize(, 9)) = 0 Then

.Rows(i).Delete
End If
Next i
End With

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"pgarcia" wrote in message
...
I'm looking to delete rows that have no data from A106:I205. This will
always
be a fixed spot.

Thanks.




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 304
Default Delete row with no data

Thanks, but that did not work. I wonder if it's my spreed sheet. I'm working
in Off 2K

"Vergel Adriano" wrote:

maybe something like this

Sub test()

Dim c As Range
Dim rngDelete As Range

For Each c In ActiveSheet.Range("A106:A205")
If WorksheetFunction.CountA(c.Resize(1, 9)) = 0 Then
If rngDelete Is Nothing Then
Set rngDelete = c.EntireRow
Else
Set rngDelete = Union(rngDelete, c.EntireRow)
End If
End If
Next c

If Not rngDelete Is Nothing Then rngDelete.Delete


End Sub


--
Hope that helps.

Vergel Adriano


"pgarcia" wrote:

I'm looking to delete rows that have no data from A106:I205. This will always
be a fixed spot.

Thanks.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Delete row with no data

Then the cells are not empty

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"pgarcia" wrote in message ...
Thanks, but it did not work.

"Ron de Bruin" wrote:

See
http://www.rondebruin.nl/delete.htm

Try

Sub Loop_Example()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

'We use the ActiveSheet but you can replace this with
'Sheets("MySheet")if you want
With ActiveSheet

'We select the sheet so we can change the window view
.Select

'If you are in Page Break Preview Or Page Layout view go
'back to normal view, we do this for speed
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

'Turn off Page Breaks, we do this for speed
.DisplayPageBreaks = False

'Set the first and last row to loop through
Firstrow = 106
Lastrow = 205

'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1

If Application.CountA(.Range(.Cells(Lrow, "A"), .Cells(Lrow, "I"))) = 0 _
Then .Rows(Lrow).Delete
'This will delete the row if the A-I cells in the row are empty

Next Lrow

End With

ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"pgarcia" wrote in message ...
I'm looking to delete rows that have no data from A106:I205. This will always
be a fixed spot.

Thanks.


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 304
Default Delete row with no data

Ok, it did work. How ever I have to high-lit the rows that have no data and
click "delete". Where is some kind of data there but it does not show. I did
find a " ' " in when of the cells, but that did not seem to be the problem.
How can I get around this? I seem that colum A does not have data.

"Vergel Adriano" wrote:

maybe something like this

Sub test()

Dim c As Range
Dim rngDelete As Range

For Each c In ActiveSheet.Range("A106:A205")
If WorksheetFunction.CountA(c.Resize(1, 9)) = 0 Then
If rngDelete Is Nothing Then
Set rngDelete = c.EntireRow
Else
Set rngDelete = Union(rngDelete, c.EntireRow)
End If
End If
Next c

If Not rngDelete Is Nothing Then rngDelete.Delete


End Sub


--
Hope that helps.

Vergel Adriano


"pgarcia" wrote:

I'm looking to delete rows that have no data from A106:I205. This will always
be a fixed spot.

Thanks.



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Delete row with no data

Is column A is empty see

Sub DeleteBlankRows_2()
'This macro delete all rows with a blank cell in column A
'If there are no blanks or there are too many areas you see a MsgBox
Dim CCount As Long
On Error Resume Next

With Columns("A") ' You can also use a range like this Range("A1:A8000")
CCount = .SpecialCells(xlCellTypeBlanks).Areas(1).Cells.Cou nt
If CCount = 0 Then
MsgBox "There are no blank cells"
ElseIf CCount = .Cells.Count Then
MsgBox "There are more then 8192 areas"
Else
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End If
End With

On Error GoTo 0
End Sub

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"pgarcia" wrote in message ...
Ok, it did work. How ever I have to high-lit the rows that have no data and
click "delete". Where is some kind of data there but it does not show. I did
find a " ' " in when of the cells, but that did not seem to be the problem.
How can I get around this? I seem that colum A does not have data.

"Vergel Adriano" wrote:

maybe something like this

Sub test()

Dim c As Range
Dim rngDelete As Range

For Each c In ActiveSheet.Range("A106:A205")
If WorksheetFunction.CountA(c.Resize(1, 9)) = 0 Then
If rngDelete Is Nothing Then
Set rngDelete = c.EntireRow
Else
Set rngDelete = Union(rngDelete, c.EntireRow)
End If
End If
Next c

If Not rngDelete Is Nothing Then rngDelete.Delete


End Sub


--
Hope that helps.

Vergel Adriano


"pgarcia" wrote:

I'm looking to delete rows that have no data from A106:I205. This will always
be a fixed spot.

Thanks.

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
If data is returned then delete data LiveUser Excel Worksheet Functions 1 November 14th 07 12:22 AM
Delete duplicate data based on date of data Phillip[_5_] Excel Programming 1 January 24th 07 05:55 PM
Using autofilter to ADD data not delete data jim_0068[_7_] Excel Programming 1 May 9th 06 03:49 PM
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


All times are GMT +1. The time now is 08:09 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"