PC Review


Reply
Thread Tools Rate Thread

Delete specific range of cells if containing "0"

 
 
=?Utf-8?B?RWxreVNT?=
Guest
Posts: n/a
 
      8th Oct 2006
OK, I am going to try to explain this as well as I can. I have a sheet that
has a lot of data that is copied out of several web pages at work and placed
into Excel below row 40. All of that data gets hidden and all that is left
is a report above row 40 that is pulling specific pieces of what was copied
and doing some conditional formatting. In Every other cell from I5 – AG5 are
names of managers at work. The cells that that skipped are hidden so that
they can do some additional calculations for the conditional formatting.
Then in rows 6 – 31 are the stats that are being pulled from the data I
mentioned earlier. This report is set up to run for as many as 13 managers
at a time, but may be ran for less if there are not as many involved in the
html reports. All of that works fine from what I can tell… It is a lot of
info… My question is, If I run it for say 9 managers rather than the 13 it
is set up for, the last 4 columns that are showing (as well as the hidden
ones) all have “0”’s in them since all of the names get pushed left. Is
there a way that I can say something along the lines of ‘Find the first cell
from A5 – AG5 that contains a “0” and then Delete the range [said column
containing “0”]1 – AG31. I can not delete the entire column because it would
cause missing data from what has been copied in below and hidden. I only
want to delete the range (?1 – AG31) of cells that do not actually have any
real data in them.
 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      9th Oct 2006
Sub ABC()
Dim cell as Range
for each cell in Range("A5:AG5")
if cell.Value = 0 then
Range(cell.offset(-4,0),Range("AG31")).ClearContents
exit for
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"ElkySS" <(E-Mail Removed)> wrote in message
news:5B966771-2B9D-43D5-86F0-(E-Mail Removed)...
> OK, I am going to try to explain this as well as I can. I have a sheet
> that
> has a lot of data that is copied out of several web pages at work and
> placed
> into Excel below row 40. All of that data gets hidden and all that is
> left
> is a report above row 40 that is pulling specific pieces of what was
> copied
> and doing some conditional formatting. In Every other cell from I5 - AG5
> are
> names of managers at work. The cells that that skipped are hidden so that
> they can do some additional calculations for the conditional formatting.
> Then in rows 6 - 31 are the stats that are being pulled from the data I
> mentioned earlier. This report is set up to run for as many as 13
> managers
> at a time, but may be ran for less if there are not as many involved in
> the
> html reports. All of that works fine from what I can tell. It is a lot
> of
> info. My question is, If I run it for say 9 managers rather than the 13
> it
> is set up for, the last 4 columns that are showing (as well as the hidden
> ones) all have "0"'s in them since all of the names get pushed left. Is
> there a way that I can say something along the lines of 'Find the first
> cell
> from A5 - AG5 that contains a "0" and then Delete the range [said column
> containing "0"]1 - AG31. I can not delete the entire column because it
> would
> cause missing data from what has been copied in below and hidden. I only
> want to delete the range (?1 - AG31) of cells that do not actually have
> any
> real data in them.



 
Reply With Quote
 
=?Utf-8?B?RWxreVNT?=
Guest
Posts: n/a
 
      9th Oct 2006
OK that makes so much sence not that I see it... Only one more thing.. What
do I need to chang .ClearContents to to make it actually delete the cells and
shift the blank area left so that I do not even see them at all. I tried
changing it to:

Range(cell.Offset(-4, 0), Range("AG31")).Selection.Delete Shift:=xlToLeft

and got nowhere with it... What am I missing?

Thanks again..

"Tom Ogilvy" wrote:

> Sub ABC()
> Dim cell as Range
> for each cell in Range("A5:AG5")
> if cell.Value = 0 then
> Range(cell.offset(-4,0),Range("AG31")).ClearContents
> exit for
> end if
> Next
> End Sub
>
> --
> Regards,
> Tom Ogilvy
>
>
> "ElkySS" <(E-Mail Removed)> wrote in message
> news:5B966771-2B9D-43D5-86F0-(E-Mail Removed)...
> > OK, I am going to try to explain this as well as I can. I have a sheet
> > that
> > has a lot of data that is copied out of several web pages at work and
> > placed
> > into Excel below row 40. All of that data gets hidden and all that is
> > left
> > is a report above row 40 that is pulling specific pieces of what was
> > copied
> > and doing some conditional formatting. In Every other cell from I5 - AG5
> > are
> > names of managers at work. The cells that that skipped are hidden so that
> > they can do some additional calculations for the conditional formatting.
> > Then in rows 6 - 31 are the stats that are being pulled from the data I
> > mentioned earlier. This report is set up to run for as many as 13
> > managers
> > at a time, but may be ran for less if there are not as many involved in
> > the
> > html reports. All of that works fine from what I can tell. It is a lot
> > of
> > info. My question is, If I run it for say 9 managers rather than the 13
> > it
> > is set up for, the last 4 columns that are showing (as well as the hidden
> > ones) all have "0"'s in them since all of the names get pushed left. Is
> > there a way that I can say something along the lines of 'Find the first
> > cell
> > from A5 - AG5 that contains a "0" and then Delete the range [said column
> > containing "0"]1 - AG31. I can not delete the entire column because it
> > would
> > cause missing data from what has been copied in below and hidden. I only
> > want to delete the range (?1 - AG31) of cells that do not actually have
> > any
> > real data in them.

>
>
>

 
Reply With Quote
 
=?Utf-8?B?RWxreVNT?=
Guest
Posts: n/a
 
      9th Oct 2006
Great code is always so simple... It makes sence now that I am looking at
it. Only one more thing. What would I have to change .ClearContents to to
make it just del that entire range and shift the blank sells to the left? I
changed it to:
Range(cell.Offset(-4, 0), Range("AG31")).Selection.Delete Shift:=xlToLeft
and go nowhere with it... What am I missing here?
Thanks again..

"Tom Ogilvy" wrote:

> Sub ABC()
> Dim cell as Range
> for each cell in Range("A5:AG5")
> if cell.Value = 0 then
> Range(cell.offset(-4,0),Range("AG31")).ClearContents
> exit for
> end if
> Next
> End Sub
>
> --
> Regards,
> Tom Ogilvy
>
>
> "ElkySS" <(E-Mail Removed)> wrote in message
> news:5B966771-2B9D-43D5-86F0-(E-Mail Removed)...
> > OK, I am going to try to explain this as well as I can. I have a sheet
> > that
> > has a lot of data that is copied out of several web pages at work and
> > placed
> > into Excel below row 40. All of that data gets hidden and all that is
> > left
> > is a report above row 40 that is pulling specific pieces of what was
> > copied
> > and doing some conditional formatting. In Every other cell from I5 - AG5
> > are
> > names of managers at work. The cells that that skipped are hidden so that
> > they can do some additional calculations for the conditional formatting.
> > Then in rows 6 - 31 are the stats that are being pulled from the data I
> > mentioned earlier. This report is set up to run for as many as 13
> > managers
> > at a time, but may be ran for less if there are not as many involved in
> > the
> > html reports. All of that works fine from what I can tell. It is a lot
> > of
> > info. My question is, If I run it for say 9 managers rather than the 13
> > it
> > is set up for, the last 4 columns that are showing (as well as the hidden
> > ones) all have "0"'s in them since all of the names get pushed left. Is
> > there a way that I can say something along the lines of 'Find the first
> > cell
> > from A5 - AG5 that contains a "0" and then Delete the range [said column
> > containing "0"]1 - AG31. I can not delete the entire column because it
> > would
> > cause missing data from what has been copied in below and hidden. I only
> > want to delete the range (?1 - AG31) of cells that do not actually have
> > any
> > real data in them.

>
>
>

 
Reply With Quote
 
=?Utf-8?B?RWxreVNT?=
Guest
Posts: n/a
 
      9th Oct 2006
Great code is always so simple... It makes sence now that I am looking at
it. Only one more thing. What would I have to change .ClearContents to to
make it just del that entire range and shift the blank sells to the left? I
changed it to:
Range(cell.Offset(-4, 0), Range("AG31")).Selection.Delete Shift:=xlToLeft
and go nowhere with it... What am I missing here?
Thanks again..

"Tom Ogilvy" wrote:

> Sub ABC()
> Dim cell as Range
> for each cell in Range("A5:AG5")
> if cell.Value = 0 then
> Range(cell.offset(-4,0),Range("AG31")).ClearContents
> exit for
> end if
> Next
> End Sub
>
> --
> Regards,
> Tom Ogilvy
>
>
> "ElkySS" <(E-Mail Removed)> wrote in message
> news:5B966771-2B9D-43D5-86F0-(E-Mail Removed)...
> > OK, I am going to try to explain this as well as I can. I have a sheet
> > that
> > has a lot of data that is copied out of several web pages at work and
> > placed
> > into Excel below row 40. All of that data gets hidden and all that is
> > left
> > is a report above row 40 that is pulling specific pieces of what was
> > copied
> > and doing some conditional formatting. In Every other cell from I5 - AG5
> > are
> > names of managers at work. The cells that that skipped are hidden so that
> > they can do some additional calculations for the conditional formatting.
> > Then in rows 6 - 31 are the stats that are being pulled from the data I
> > mentioned earlier. This report is set up to run for as many as 13
> > managers
> > at a time, but may be ran for less if there are not as many involved in
> > the
> > html reports. All of that works fine from what I can tell. It is a lot
> > of
> > info. My question is, If I run it for say 9 managers rather than the 13
> > it
> > is set up for, the last 4 columns that are showing (as well as the hidden
> > ones) all have "0"'s in them since all of the names get pushed left. Is
> > there a way that I can say something along the lines of 'Find the first
> > cell
> > from A5 - AG5 that contains a "0" and then Delete the range [said column
> > containing "0"]1 - AG31. I can not delete the entire column because it
> > would
> > cause missing data from what has been copied in below and hidden. I only
> > want to delete the range (?1 - AG31) of cells that do not actually have
> > any
> > real data in them.

>
>
>

 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      9th Oct 2006
Sub ABC()
Dim cell as Range
for each cell in Range("A5:AG5")
if cell.Value = 0 then
Range(cell.offset(-4,0),Range("AG31")) _
.Delete Shift:=xlShifttoLeft
exit for
end if
Next
End Sub

--
Regards,
Tom Ogilvy



"ElkySS" <(E-Mail Removed)> wrote in message
news:07991A47-0B12-494E-A531-(E-Mail Removed)...
> OK that makes so much sence not that I see it... Only one more thing..
> What
> do I need to chang .ClearContents to to make it actually delete the cells
> and
> shift the blank area left so that I do not even see them at all. I tried
> changing it to:
>
> Range(cell.Offset(-4, 0), Range("AG31")).Selection.Delete Shift:=xlToLeft
>
> and got nowhere with it... What am I missing?
>
> Thanks again..
>
> "Tom Ogilvy" wrote:
>
>> Sub ABC()
>> Dim cell as Range
>> for each cell in Range("A5:AG5")
>> if cell.Value = 0 then
>> Range(cell.offset(-4,0),Range("AG31")).ClearContents
>> exit for
>> end if
>> Next
>> End Sub
>>
>> --
>> Regards,
>> Tom Ogilvy
>>
>>
>> "ElkySS" <(E-Mail Removed)> wrote in message
>> news:5B966771-2B9D-43D5-86F0-(E-Mail Removed)...
>> > OK, I am going to try to explain this as well as I can. I have a sheet
>> > that
>> > has a lot of data that is copied out of several web pages at work and
>> > placed
>> > into Excel below row 40. All of that data gets hidden and all that is
>> > left
>> > is a report above row 40 that is pulling specific pieces of what was
>> > copied
>> > and doing some conditional formatting. In Every other cell from I5 -
>> > AG5
>> > are
>> > names of managers at work. The cells that that skipped are hidden so
>> > that
>> > they can do some additional calculations for the conditional
>> > formatting.
>> > Then in rows 6 - 31 are the stats that are being pulled from the data I
>> > mentioned earlier. This report is set up to run for as many as 13
>> > managers
>> > at a time, but may be ran for less if there are not as many involved in
>> > the
>> > html reports. All of that works fine from what I can tell. It is a
>> > lot
>> > of
>> > info. My question is, If I run it for say 9 managers rather than the
>> > 13
>> > it
>> > is set up for, the last 4 columns that are showing (as well as the
>> > hidden
>> > ones) all have "0"'s in them since all of the names get pushed left.
>> > Is
>> > there a way that I can say something along the lines of 'Find the first
>> > cell
>> > from A5 - AG5 that contains a "0" and then Delete the range [said
>> > column
>> > containing "0"]1 - AG31. I can not delete the entire column because it
>> > would
>> > cause missing data from what has been copied in below and hidden. I
>> > only
>> > want to delete the range (?1 - AG31) of cells that do not actually have
>> > any
>> > real data in them.

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?RWxreVNT?=
Guest
Posts: n/a
 
      9th Oct 2006
u the man... that worked great.. ty so much.


"Tom Ogilvy" wrote:

> Sub ABC()
> Dim cell as Range
> for each cell in Range("A5:AG5")
> if cell.Value = 0 then
> Range(cell.offset(-4,0),Range("AG31")) _
> .Delete Shift:=xlShifttoLeft
> exit for
> end if
> Next
> End Sub
>
> --
> Regards,
> Tom Ogilvy
>
>
>
> "ElkySS" <(E-Mail Removed)> wrote in message
> news:07991A47-0B12-494E-A531-(E-Mail Removed)...
> > OK that makes so much sence not that I see it... Only one more thing..
> > What
> > do I need to chang .ClearContents to to make it actually delete the cells
> > and
> > shift the blank area left so that I do not even see them at all. I tried
> > changing it to:
> >
> > Range(cell.Offset(-4, 0), Range("AG31")).Selection.Delete Shift:=xlToLeft
> >
> > and got nowhere with it... What am I missing?
> >
> > Thanks again..
> >
> > "Tom Ogilvy" wrote:
> >
> >> Sub ABC()
> >> Dim cell as Range
> >> for each cell in Range("A5:AG5")
> >> if cell.Value = 0 then
> >> Range(cell.offset(-4,0),Range("AG31")).ClearContents
> >> exit for
> >> end if
> >> Next
> >> End Sub
> >>
> >> --
> >> Regards,
> >> Tom Ogilvy
> >>
> >>
> >> "ElkySS" <(E-Mail Removed)> wrote in message
> >> news:5B966771-2B9D-43D5-86F0-(E-Mail Removed)...
> >> > OK, I am going to try to explain this as well as I can. I have a sheet
> >> > that
> >> > has a lot of data that is copied out of several web pages at work and
> >> > placed
> >> > into Excel below row 40. All of that data gets hidden and all that is
> >> > left
> >> > is a report above row 40 that is pulling specific pieces of what was
> >> > copied
> >> > and doing some conditional formatting. In Every other cell from I5 -
> >> > AG5
> >> > are
> >> > names of managers at work. The cells that that skipped are hidden so
> >> > that
> >> > they can do some additional calculations for the conditional
> >> > formatting.
> >> > Then in rows 6 - 31 are the stats that are being pulled from the data I
> >> > mentioned earlier. This report is set up to run for as many as 13
> >> > managers
> >> > at a time, but may be ran for less if there are not as many involved in
> >> > the
> >> > html reports. All of that works fine from what I can tell. It is a
> >> > lot
> >> > of
> >> > info. My question is, If I run it for say 9 managers rather than the
> >> > 13
> >> > it
> >> > is set up for, the last 4 columns that are showing (as well as the
> >> > hidden
> >> > ones) all have "0"'s in them since all of the names get pushed left.
> >> > Is
> >> > there a way that I can say something along the lines of 'Find the first
> >> > cell
> >> > from A5 - AG5 that contains a "0" and then Delete the range [said
> >> > column
> >> > containing "0"]1 - AG31. I can not delete the entire column because it
> >> > would
> >> > cause missing data from what has been copied in below and hidden. I
> >> > only
> >> > want to delete the range (?1 - AG31) of cells that do not actually have
> >> > any
> >> > real data in them.
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calcuting sum of specific word "P" within specific cell range (A5: billy liddel Microsoft Excel Worksheet Functions 3 26th Sep 2009 12:17 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Microsoft Excel Misc 11 28th Dec 2006 04:44 PM
Re: Massive "FIND" or " Compare cells " then , Delete.... Angela Microsoft Excel Discussion 8 3rd Oct 2004 07:17 PM
Sum a range of cells with without the first character "text" & "numerical" John Microsoft Excel Worksheet Functions 5 12th Sep 2004 07:56 PM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives Microsoft Excel Programming 3 5th Jun 2004 03:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:18 PM.