Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default select rows and delete based on criteria

hi sorry for being a pain...

I have a worksheet with data from column A to E and from rows 1 to (lets
say) 5000. I want a macro that serches for rows that have "2" in column C and
are NOT BLANK, then select all thses rows from column A to IV (not just A to
E) and then delete them (shiftng all other rows up but i think this happens
automatically. How can I do this.

Also in the resulting table I want to select all remaianing rows (again from
A to IV).

thank you.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default select rows and delete based on criteria

Hi Steven

Start here
http://www.rondebruin.nl/delete.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"steven" wrote in message ...
hi sorry for being a pain...

I have a worksheet with data from column A to E and from rows 1 to (lets
say) 5000. I want a macro that serches for rows that have "2" in column C and
are NOT BLANK, then select all thses rows from column A to IV (not just A to
E) and then delete them (shiftng all other rows up but i think this happens
automatically. How can I do this.

Also in the resulting table I want to select all remaianing rows (again from
A to IV).

thank you.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default select rows and delete based on criteria

this is what i made out of the webpage

Sub deleterows2crtr()
ElseIf .Cells(Lrow, "E").Value = "2" And _
.Cells(Lrow, "G").Value < 0 Then .Rows(Lrow).Delete
End Sub

it dosent seem to work though. Invalid criteria or something. Can you help
out?

S.

"Ron de Bruin" wrote:

Hi Steven

Start here
http://www.rondebruin.nl/delete.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"steven" wrote in message ...
hi sorry for being a pain...

I have a worksheet with data from column A to E and from rows 1 to (lets
say) 5000. I want a macro that serches for rows that have "2" in column C and
are NOT BLANK, then select all thses rows from column A to IV (not just A to
E) and then delete them (shiftng all other rows up but i think this happens
automatically. How can I do this.

Also in the resulting table I want to select all remaianing rows (again from
A to IV).

thank you.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default select rows and delete based on criteria

Hi Steven

Try this

Sub Example2()
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
Dim StartRow As Long
Dim EndRow As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = 5000

For Lrow = EndRow To StartRow Step -1

If .Cells(Lrow, "E").Value = 2 And _
.Cells(Lrow, "G").Value < 0 Then .Rows(Lrow).Delete

Next
End With

ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub





--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"steven" wrote in message ...
this is what i made out of the webpage

Sub deleterows2crtr()
ElseIf .Cells(Lrow, "E").Value = "2" And _
.Cells(Lrow, "G").Value < 0 Then .Rows(Lrow).Delete
End Sub

it dosent seem to work though. Invalid criteria or something. Can you help
out?

S.

"Ron de Bruin" wrote:

Hi Steven

Start here
http://www.rondebruin.nl/delete.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"steven" wrote in message ...
hi sorry for being a pain...

I have a worksheet with data from column A to E and from rows 1 to (lets
say) 5000. I want a macro that serches for rows that have "2" in column C and
are NOT BLANK, then select all thses rows from column A to IV (not just A to
E) and then delete them (shiftng all other rows up but i think this happens
automatically. How can I do this.

Also in the resulting table I want to select all remaianing rows (again from
A to IV).

thank you.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default select rows and delete based on criteria

niewbe me... never mind I figured t out!

thank you!

"Ron de Bruin" wrote:

Hi Steven

Start here
http://www.rondebruin.nl/delete.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"steven" wrote in message ...
hi sorry for being a pain...

I have a worksheet with data from column A to E and from rows 1 to (lets
say) 5000. I want a macro that serches for rows that have "2" in column C and
are NOT BLANK, then select all thses rows from column A to IV (not just A to
E) and then delete them (shiftng all other rows up but i think this happens
automatically. How can I do this.

Also in the resulting table I want to select all remaianing rows (again from
A to IV).

thank you.



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
Delete rows based on multiple criteria puiuluipui Excel Discussion (Misc queries) 6 July 3rd 09 01:58 PM
How can I delete rows programmatically based on certain criteria? nt_artagnian[_2_] New Users to Excel 2 March 8th 07 03:56 AM
Delete rows based on criteria Chris_t_2k5 Excel Discussion (Misc queries) 2 April 11th 06 01:52 PM
Delete rows based on certain criteria Coal Miner Excel Discussion (Misc queries) 2 March 3rd 06 05:56 PM
Select rows based on criteria sotiris_s Excel Worksheet Functions 4 November 14th 05 12:35 PM


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