Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default Deleting - Rick Rothstein

Hi Rod,

Thanks for your help once again.

Is it possible to adapt the formula u just gave me, (below), in order to
delete any cells in col I that have a grey shading?

Range("E4:E" & Rows.Count).SpecialCells(xlCellTypeBlanks).EntireR ow.Delete

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Deleting - Rick Rothstein

see my additional reply to your earleir mail

"LiAD" wrote:

Hi Rod,

Thanks for your help once again.

Is it possible to adapt the formula u just gave me, (below), in order to
delete any cells in col I that have a grey shading?

Range("E4:E" & Rows.Count).SpecialCells(xlCellTypeBlanks).EntireR ow.Delete

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Deleting - Rick Rothstein

You will need a loop to do that. Assuming your "grey" shading is ColorIndex
15, and that the column you want to search in for this color is Column E,
then this simple looping code should do what you want quite efficiently...

Application.FindFormat.Interior.ColorIndex = 15
On Error GoTo Done
Do
Range("E1:E" & Rows.Count).Find("*", SearchFormat:=True). _
EntireRow.Delete xlShiftUp
Loop
Done:

--
Rick (MVP - Excel)


"LiAD" wrote in message
...
Hi Rod,

Thanks for your help once again.

Is it possible to adapt the formula u just gave me, (below), in order to
delete any cells in col I that have a grey shading?

Range("E4:E" & Rows.Count).SpecialCells(xlCellTypeBlanks).EntireR ow.Delete

Thanks


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default Deleting - Rick Rothstein

Thanks.

I'm getting an error on this line

Range("I3:I" & Rows.Count).Find("*", SearchFormat:=True).EntireRow.delete
xlShiftUp

Any ideas why this might be?

"Rick Rothstein" wrote:

You will need a loop to do that. Assuming your "grey" shading is ColorIndex
15, and that the column you want to search in for this color is Column E,
then this simple looping code should do what you want quite efficiently...

Application.FindFormat.Interior.ColorIndex = 15
On Error GoTo Done
Do
Range("E1:E" & Rows.Count).Find("*", SearchFormat:=True). _
EntireRow.Delete xlShiftUp
Loop
Done:

--
Rick (MVP - Excel)


"LiAD" wrote in message
...
Hi Rod,

Thanks for your help once again.

Is it possible to adapt the formula u just gave me, (below), in order to
delete any cells in col I that have a grey shading?

Range("E4:E" & Rows.Count).SpecialCells(xlCellTypeBlanks).EntireR ow.Delete

Thanks



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Deleting - Rick Rothstein

First off, in case you haven't looked yet, I posted some code to the other
thread we have been working on (Subject: Tough Teaser).

Now, for this problem... sorry, I tested my code with values filled into the
cells... I'm assuming your cells are empty (in the future, you should tell
us what the error is, not just that you got one... it saves us from
guessing). The asterisk in the Find method is making it look for text. The
way to just look for the color (whether there is text in the cell or not) is
to remove the asterisk and just use the empty string "". Try it this way...

Application.FindFormat.Interior.ColorIndex = 15
On Error GoTo Done
Do
Range("E1:E" & Rows.Count).Find("", SearchFormat:=True). _
EntireRow.Delete xlShiftUp
Loop
Done:

--
Rick (MVP - Excel)


"LiAD" wrote in message
...
Thanks.

I'm getting an error on this line

Range("I3:I" & Rows.Count).Find("*", SearchFormat:=True).EntireRow.delete
xlShiftUp

Any ideas why this might be?

"Rick Rothstein" wrote:

You will need a loop to do that. Assuming your "grey" shading is
ColorIndex
15, and that the column you want to search in for this color is Column E,
then this simple looping code should do what you want quite
efficiently...

Application.FindFormat.Interior.ColorIndex = 15
On Error GoTo Done
Do
Range("E1:E" & Rows.Count).Find("*", SearchFormat:=True). _
EntireRow.Delete xlShiftUp
Loop
Done:

--
Rick (MVP - Excel)


"LiAD" wrote in message
...
Hi Rod,

Thanks for your help once again.

Is it possible to adapt the formula u just gave me, (below), in order
to
delete any cells in col I that have a grey shading?

Range("E4:E" &
Rows.Count).SpecialCells(xlCellTypeBlanks).EntireR ow.Delete

Thanks






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default Deleting - Rick Rothstein

Hi thanks for contining.

I havent forgotten the other post. I had stopped for the day.

The cells being deleted have numbers as well as the grey filling.

The error I'm getting is Run-time error 91. Object variable or with block
variable not set.

The code is actually doing what is asked to do - it deletes all the greyed
cells the problem is starting when it tries to do the loop. If i put a stop
on loop, the code works fine before this and only gets this error when it
tries to continue. When the error appears it highlights in yellow the same
line as before, with or without the *.



"Rick Rothstein" wrote:

First off, in case you haven't looked yet, I posted some code to the other
thread we have been working on (Subject: Tough Teaser).

Now, for this problem... sorry, I tested my code with values filled into the
cells... I'm assuming your cells are empty (in the future, you should tell
us what the error is, not just that you got one... it saves us from
guessing). The asterisk in the Find method is making it look for text. The
way to just look for the color (whether there is text in the cell or not) is
to remove the asterisk and just use the empty string "". Try it this way...

Application.FindFormat.Interior.ColorIndex = 15
On Error GoTo Done
Do
Range("E1:E" & Rows.Count).Find("", SearchFormat:=True). _
EntireRow.Delete xlShiftUp
Loop
Done:

--
Rick (MVP - Excel)


"LiAD" wrote in message
...
Thanks.

I'm getting an error on this line

Range("I3:I" & Rows.Count).Find("*", SearchFormat:=True).EntireRow.delete
xlShiftUp

Any ideas why this might be?

"Rick Rothstein" wrote:

You will need a loop to do that. Assuming your "grey" shading is
ColorIndex
15, and that the column you want to search in for this color is Column E,
then this simple looping code should do what you want quite
efficiently...

Application.FindFormat.Interior.ColorIndex = 15
On Error GoTo Done
Do
Range("E1:E" & Rows.Count).Find("*", SearchFormat:=True). _
EntireRow.Delete xlShiftUp
Loop
Done:

--
Rick (MVP - Excel)


"LiAD" wrote in message
...
Hi Rod,

Thanks for your help once again.

Is it possible to adapt the formula u just gave me, (below), in order
to
delete any cells in col I that have a grey shading?

Range("E4:E" &
Rows.Count).SpecialCells(xlCellTypeBlanks).EntireR ow.Delete

Thanks




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Deleting - Rick Rothstein

The code, as written, assumes the worksheet you are searching is the active
sheet. You can either activate the worksheet before running the code or you
can preface the Range with the worksheet that is supposed to be search on
(doing this means you wouldn't have to activate the worksheet). To do the
latter, the code would look like this...

Application.FindFormat.Interior.ColorIndex = 15
On Error GoTo Done
Do
Worksheets("Sheet1").Range("E1:E" & Rows.Count).Find("", _
SearchFormat:=True).EntireRow.Delete xlShiftUp
Loop
Done:

where you would change my example Sheet1 worksheet name to the actual
worksheet name that your search is to take place on.

--
Rick (MVP - Excel)


"LiAD" wrote in message
...
Hi thanks for contining.

I havent forgotten the other post. I had stopped for the day.

The cells being deleted have numbers as well as the grey filling.

The error I'm getting is Run-time error 91. Object variable or with block
variable not set.

The code is actually doing what is asked to do - it deletes all the greyed
cells the problem is starting when it tries to do the loop. If i put a
stop
on loop, the code works fine before this and only gets this error when it
tries to continue. When the error appears it highlights in yellow the
same
line as before, with or without the *.



"Rick Rothstein" wrote:

First off, in case you haven't looked yet, I posted some code to the
other
thread we have been working on (Subject: Tough Teaser).

Now, for this problem... sorry, I tested my code with values filled into
the
cells... I'm assuming your cells are empty (in the future, you should
tell
us what the error is, not just that you got one... it saves us from
guessing). The asterisk in the Find method is making it look for text.
The
way to just look for the color (whether there is text in the cell or not)
is
to remove the asterisk and just use the empty string "". Try it this
way...

Application.FindFormat.Interior.ColorIndex = 15
On Error GoTo Done
Do
Range("E1:E" & Rows.Count).Find("", SearchFormat:=True). _
EntireRow.Delete xlShiftUp
Loop
Done:

--
Rick (MVP - Excel)


"LiAD" wrote in message
...
Thanks.

I'm getting an error on this line

Range("I3:I" & Rows.Count).Find("*",
SearchFormat:=True).EntireRow.delete
xlShiftUp

Any ideas why this might be?

"Rick Rothstein" wrote:

You will need a loop to do that. Assuming your "grey" shading is
ColorIndex
15, and that the column you want to search in for this color is Column
E,
then this simple looping code should do what you want quite
efficiently...

Application.FindFormat.Interior.ColorIndex = 15
On Error GoTo Done
Do
Range("E1:E" & Rows.Count).Find("*", SearchFormat:=True). _
EntireRow.Delete xlShiftUp
Loop
Done:

--
Rick (MVP - Excel)


"LiAD" wrote in message
...
Hi Rod,

Thanks for your help once again.

Is it possible to adapt the formula u just gave me, (below), in
order
to
delete any cells in col I that have a grey shading?

Range("E4:E" &
Rows.Count).SpecialCells(xlCellTypeBlanks).EntireR ow.Delete

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
Copy Entire Row - Rick Rothstein ? Hennie Neuhoff Excel Programming 2 August 15th 09 02:16 PM
For Rick Rothstein retired bill Excel Programming 1 May 7th 09 05:50 PM
Rick Rothstein Gordy99 Excel Programming 0 February 28th 08 07:05 PM
Question for Rick Rothstein Jenny B. Excel Discussion (Misc queries) 0 June 27th 07 07:06 PM
answer to Rick Axel Excel Programming 7 June 25th 07 09:00 PM


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