Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete rows that have data less than 20 items or less than value of £300
Tom Ogilvy wrote:
Dim res as Variant, res1 as Variant dim qty as Long, pounds as Long Dim i as Long, LastRow as Long Tom, it won't complie at line 3 of your code? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200510/1 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete rows that have data less than 20 items or less than value of £300
In contrast, I copied it out of my posting and pasted it into a new module.
Ran it and it performed flawlessly. I have modified it to put in default values of 20 and 300 in the inputboxes, so if you don't want to change you just hit OK or enter did you look for stray characters? In the early days of the "new" google interface, some code was coming in with a stray hypen as I recall. Sub CC() Dim res As Variant, res1 As Variant Dim qty As Long, pounds As Long Dim i As Long, LastRow As Long res = InputBox("Enter Minimum Items to Stay", _ Default:=20) res1 = InputBox("Enter Minimum £ to Stay", _ Default:=300) If Not (IsNumeric(res) And IsNumeric(res1)) Then MsgBox "Invalid Values, quiting" Exit Sub End If qty = CLng(res) pounds = CLng(res1) LastRow = Cells(Rows.Count, 1).End(xlUp).Row For i = LastRow To 2 Step -1 If Cells(i, 1) < qty And Cells(i, 2) < pounds Then Rows(i).Delete End If Next End Sub -- Regards, Tom Ogilvy "Crowbar via OfficeKB.com" <u15117@uwe wrote in message news:5655097700021@uwe... Tom Ogilvy wrote: Dim res as Variant, res1 as Variant dim qty as Long, pounds as Long Dim i as Long, LastRow as Long Tom, it won't complie at line 3 of your code? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200510/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Show items with no data on rows | Excel Discussion (Misc queries) | |||
Delete rows data moving | Excel Discussion (Misc queries) | |||
always display rows in Pivot tables (show items with no data) | Excel Discussion (Misc queries) | |||
Delete rows with no data | Setting up and Configuration of Excel | |||
Delete certain rows of data... | Excel Programming |