Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Deletion of rows where a value is satisfied for all the sheets

Hi,
I am using the following macro to delete the rows where the value is
"Total" in Column D.
How can I run it for all the Sheets in the Active Workbook
Any suggestions or help would be appreciated.

Sub DeleteRows()
Dim cLastRow As Long
Dim i As Long
cLastRow = Cells(Rows.Count, "D").End(xlUp).Row
For i = cLastRow To 1 Step -1
If Cells(i, "D").Value = "Total" Then
Cells(i, "D").EntireRow.Delete
End If
Next i
End Sub

TIA
Rashid Khan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deletion of rows where a value is satisfied for all the sheets

Sub DeleteRows()
Dim cLastRow As Long
Dim i As Long
Dim sh1 as Worksheet
Dim sh as Worksheet
set sh1 = Activesheet
Application.ScreenUpdating = False
for each sh in Activeworkbook.Worksheets
sh.Activate
cLastRow = Cells(Rows.Count, "D").End(xlUp).Row
For i = cLastRow To 1 Step -1
If Cells(i, "D").Value = "Total" Then
Cells(i, "D").EntireRow.Delete
End If
Next i
Next
sh1.Activate
Application.ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy


"Rashid Khan" wrote in message
om...
Hi,
I am using the following macro to delete the rows where the value is
"Total" in Column D.
How can I run it for all the Sheets in the Active Workbook
Any suggestions or help would be appreciated.

Sub DeleteRows()
Dim cLastRow As Long
Dim i As Long
cLastRow = Cells(Rows.Count, "D").End(xlUp).Row
For i = cLastRow To 1 Step -1
If Cells(i, "D").Value = "Total" Then
Cells(i, "D").EntireRow.Delete
End If
Next i
End Sub

TIA
Rashid Khan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Deletion of rows where a value is satisfied for all the sheets

Thank you... You once again saved my day.. You are a real magician

Rashid Khan

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
Automatic deletion of specific cells from multiple sheets Jman Excel Worksheet Functions 4 June 12th 07 03:44 PM
On deletion of rows Stephen Howe Excel Discussion (Misc queries) 2 October 7th 05 06:02 PM
how do i undo deletion of sheets Krishnan Seshadri Excel Worksheet Functions 1 March 18th 05 04:47 PM
Deletion of rows where a value is satisfied Larry Wallis[_2_] Excel Programming 2 February 22nd 05 01:36 PM
Deletion of rows where a value is satisfied Larry Wallis Excel Worksheet Functions 1 February 22nd 05 12:41 PM


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