Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default how do i remove unshaded rows from Excel?

i have a large (for me) excel spread sheet. i have about 25 % of the rows
highlighted throughout the sheet. i want to remove all the unhighlighted
rows. how do i do this?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default how do i remove unshaded rows from Excel?

Sub RemoveUnhighlightedRows()
' This routine will delete all the rows that have
' no highlighted cells

Dim iFirstRow As Long
Dim iLastRow As Long
Dim i As Long
Dim j As Long
Dim bColoredRow As Boolean


' CHANGE THE TWO LINES BELOW
' TO ADAPT TO YOUR NEEDS
iFirstRow = 1
iLastRow = 1000

Application.ScreenUpdating = False

For i = iLastRow To iFirstRow Step -1
For j = 1 To 256
bColoredRow = False
If Cells(i, j).Interior.Color < RGB(255, 255, 255) Then
bColoredRow = True
Exit For
End If
Next j
If Not (bColoredRow) Then
Rows(i).Delete
End If
Next i

Application.ScreenUpdating = True

End Sub


babe_in_the_woods wrote:
i have a large (for me) excel spread sheet. i have about 25 % of the rows
highlighted throughout the sheet. i want to remove all the unhighlighted
rows. how do i do this?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200708/1

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default how do i remove unshaded rows from Excel?

i must say this looks like it will do the trick, but i don't know what to do
with these lines of code. how and where do i run them? sorry to be living up
to my "name" but i haven't a clue what to do with this.....

"squenson via OfficeKB.com" wrote:

Sub RemoveUnhighlightedRows()
' This routine will delete all the rows that have
' no highlighted cells

Dim iFirstRow As Long
Dim iLastRow As Long
Dim i As Long
Dim j As Long
Dim bColoredRow As Boolean


' CHANGE THE TWO LINES BELOW
' TO ADAPT TO YOUR NEEDS
iFirstRow = 1
iLastRow = 1000

Application.ScreenUpdating = False

For i = iLastRow To iFirstRow Step -1
For j = 1 To 256
bColoredRow = False
If Cells(i, j).Interior.Color < RGB(255, 255, 255) Then
bColoredRow = True
Exit For
End If
Next j
If Not (bColoredRow) Then
Rows(i).Delete
End If
Next i

Application.ScreenUpdating = True

End Sub


babe_in_the_woods wrote:
i have a large (for me) excel spread sheet. i have about 25 % of the rows
highlighted throughout the sheet. i want to remove all the unhighlighted
rows. how do i do this?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200708/1


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default how do i remove unshaded rows from Excel?

Since you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

babe_in_the_woods wrote:

i must say this looks like it will do the trick, but i don't know what to do
with these lines of code. how and where do i run them? sorry to be living up
to my "name" but i haven't a clue what to do with this.....

"squenson via OfficeKB.com" wrote:

Sub RemoveUnhighlightedRows()
' This routine will delete all the rows that have
' no highlighted cells

Dim iFirstRow As Long
Dim iLastRow As Long
Dim i As Long
Dim j As Long
Dim bColoredRow As Boolean


' CHANGE THE TWO LINES BELOW
' TO ADAPT TO YOUR NEEDS
iFirstRow = 1
iLastRow = 1000

Application.ScreenUpdating = False

For i = iLastRow To iFirstRow Step -1
For j = 1 To 256
bColoredRow = False
If Cells(i, j).Interior.Color < RGB(255, 255, 255) Then
bColoredRow = True
Exit For
End If
Next j
If Not (bColoredRow) Then
Rows(i).Delete
End If
Next i

Application.ScreenUpdating = True

End Sub


babe_in_the_woods wrote:
i have a large (for me) excel spread sheet. i have about 25 % of the rows
highlighted throughout the sheet. i want to remove all the unhighlighted
rows. how do i do this?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200708/1



--

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
How to remove a lot of rows? Please help User Excel Discussion (Misc queries) 2 April 30th 06 08:39 PM
Im trying to remove blank rows in an Excel spreadsheet Printout riponalong Excel Worksheet Functions 2 January 5th 06 05:58 AM
How do I remove numerous blank rows from Excel spreadsheet? JP6262AMY Excel Discussion (Misc queries) 4 August 15th 05 10:39 PM
Remove empty rows in excel? Clbmgr Excel Discussion (Misc queries) 6 December 2nd 04 02:02 AM
How do I remove blank rows in Excel? m28leics Excel Discussion (Misc queries) 2 November 29th 04 11:56 PM


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