Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default deleting cells in a range

hi
i need to step through the range A3:J107 deleting (move up) cells meeting a
certain criteria (value 10) ... and i just can't seem to get the code
right, please help

Cheers
JulieD


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default deleting cells in a range

You don't care about row integrity?

Sub BB()
Set rng = Range("A3:J107")
last = rng.Count
For i = last To 1 Step -1
If rng(i).Value 10 Then
rng(i).Delete Shift:=xlShiftUp
End If
Next
End Sub

seems to work.

--
Regards,
Tom Ogilvy



"JulieD" wrote in message
...
hi
i need to step through the range A3:J107 deleting (move up) cells meeting

a
certain criteria (value 10) ... and i just can't seem to get the code
right, please help

Cheers
JulieD




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default deleting cells in a range

Hi Tom

You don't care about row integrity?

not in this case, separate tables on a worksheet

thanks for the code, it worked well!


Cheers
JulieD


"Tom Ogilvy" wrote in message
...
You don't care about row integrity?

Sub BB()
Set rng = Range("A3:J107")
last = rng.Count
For i = last To 1 Step -1
If rng(i).Value 10 Then
rng(i).Delete Shift:=xlShiftUp
End If
Next
End Sub

seems to work.

--
Regards,
Tom Ogilvy



"JulieD" wrote in message
...
hi
i need to step through the range A3:J107 deleting (move up) cells meeting

a
certain criteria (value 10) ... and i just can't seem to get the code
right, please help

Cheers
JulieD






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default deleting cells in a range

That was a very interesting routine...and very useful in manipulating data.
Can you show what it would look like if one DID want row integrity? Seems to
me there would be no change in the filtered area if any cell on a row had
data in it in that scenario.

John
La Mesa, CA

"Tom Ogilvy" wrote in message
...
You don't care about row integrity?

Sub BB()
Set rng = Range("A3:J107")
last = rng.Count
For i = last To 1 Step -1
If rng(i).Value 10 Then
rng(i).Delete Shift:=xlShiftUp
End If
Next
End Sub

seems to work.

--
Regards,
Tom Ogilvy



"JulieD" wrote in message
...
hi
i need to step through the range A3:J107 deleting (move up) cells meeting

a
certain criteria (value 10) ... and i just can't seem to get the code
right, please help

Cheers
JulieD






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default deleting cells in a range

If you wanted row integrity, you would delete the entirerow based on the
condition - perhaps if any cell had a value greater than 10 you would delete
the entire row.

for i =107 to 3 step -1
for j = 1 to 10
if cells(i,j)10 then
rows(i).delete
exit for
end if
Next
Next

or
for i = 107 to 3 step -1
if application.countif(cells(i,1).Resize(1,10),"10") 0 then
rows(i).Delete
end if
Next

--
Regards,
Tom Ogilvy

"John W Cavoulas" wrote in message
news:Hep0e.175866$FM3.144882@fed1read02...
That was a very interesting routine...and very useful in manipulating

data.
Can you show what it would look like if one DID want row integrity? Seems

to
me there would be no change in the filtered area if any cell on a row had
data in it in that scenario.

John
La Mesa, CA

"Tom Ogilvy" wrote in message
...
You don't care about row integrity?

Sub BB()
Set rng = Range("A3:J107")
last = rng.Count
For i = last To 1 Step -1
If rng(i).Value 10 Then
rng(i).Delete Shift:=xlShiftUp
End If
Next
End Sub

seems to work.

--
Regards,
Tom Ogilvy



"JulieD" wrote in message
...
hi
i need to step through the range A3:J107 deleting (move up) cells

meeting
a
certain criteria (value 10) ... and i just can't seem to get the code
right, please help

Cheers
JulieD










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default deleting cells in a range

Thanks Tom. I was curious about that. It will be a helpful tool for deleting
incomplete records (rows of data). Our testers aren't perfect. ;-)

John


"Tom Ogilvy" wrote in message
...
If you wanted row integrity, you would delete the entirerow based on the
condition - perhaps if any cell had a value greater than 10 you would
delete
the entire row.

for i =107 to 3 step -1
for j = 1 to 10
if cells(i,j)10 then
rows(i).delete
exit for
end if
Next
Next

or
for i = 107 to 3 step -1
if application.countif(cells(i,1).Resize(1,10),"10") 0 then
rows(i).Delete
end if
Next

--
Regards,
Tom Ogilvy

"John W Cavoulas" wrote in message
news:Hep0e.175866$FM3.144882@fed1read02...
That was a very interesting routine...and very useful in manipulating

data.
Can you show what it would look like if one DID want row integrity? Seems

to
me there would be no change in the filtered area if any cell on a row had
data in it in that scenario.

John
La Mesa, CA

"Tom Ogilvy" wrote in message
...
You don't care about row integrity?

Sub BB()
Set rng = Range("A3:J107")
last = rng.Count
For i = last To 1 Step -1
If rng(i).Value 10 Then
rng(i).Delete Shift:=xlShiftUp
End If
Next
End Sub

seems to work.

--
Regards,
Tom Ogilvy



"JulieD" wrote in message
...
hi
i need to step through the range A3:J107 deleting (move up) cells

meeting
a
certain criteria (value 10) ... and i just can't seem to get the
code
right, please help

Cheers
JulieD










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
Deleting/Clearing duplicate range of cells Steve Excel Worksheet Functions 0 April 28th 10 03:59 PM
MACRO HELP - deleting rows containing a range of blank cells DavidHawes Excel Discussion (Misc queries) 9 February 26th 07 03:40 PM
Deleting Range name's listed in the range address box. Satnam Patel Excel Discussion (Misc queries) 4 May 5th 05 01:42 PM
Deleting Range using VB sjbeeny Excel Programming 5 May 29th 04 12:14 PM
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content rmaloy Excel Programming 5 February 9th 04 01:59 AM


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