#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Easy one

heres an easy one for y'all:

i have values in columns b and c from rows 5 to 600. i
would like a program that checks each row such that if
the value in column b is greater than column c, it
deletes the values in that row (or deletes the row
entirely)

ill give you a better challenge next time, i swear...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Easy one

Try this one Lawson for the ActiveSheet

Sub Example2()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 6
EndRow = 600
For Lrow = EndRow To StartRow Step -1
If .Cells(Lrow, "B").Value .Cells(Lrow, "C").Value _
Then .Rows(Lrow).Delete
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Lawson" wrote in message ...
heres an easy one for y'all:

i have values in columns b and c from rows 5 to 600. i
would like a program that checks each row such that if
the value in column b is greater than column c, it
deletes the values in that row (or deletes the row
entirely)

ill give you a better challenge next time, i swear...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Easy one


-----Original Message-----
heres an easy one for y'all:

i have values in columns b and c from rows 5 to 600. i
would like a program that checks each row such that if
the value in column b is greater than column c, it
deletes the values in that row (or deletes the row
entirely)

ill give you a better challenge next time, i swear...
.

Try this

Sub TestVals()
Dim rng As Range
Dim c As Variant
Set rng = Range(Cells(5, 2), Cells(500, 2))
For Each c In rng
If c c.Offset(0, 1) Then
c.EntireRow.Delete
End If
Next c
End Sub

Regards
Peter
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
There must be an easy way? kassie Excel Discussion (Misc queries) 5 May 26th 07 06:33 AM
pls help, is there an easy way to [email protected] Excel Worksheet Functions 12 May 3rd 07 07:04 PM
easy kyegibbon Excel Worksheet Functions 10 May 13th 06 09:20 AM
Easy one....Right? egeorge4 Excel Discussion (Misc queries) 4 May 12th 06 06:13 PM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM


All times are GMT +1. The time now is 02:11 PM.

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"