Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Show items with no data on rows J Austin Excel Discussion (Misc queries) 3 May 16th 23 03:45 AM
Delete rows data moving njoseph Excel Discussion (Misc queries) 3 June 1st 10 11:07 PM
always display rows in Pivot tables (show items with no data) Tausif Excel Discussion (Misc queries) 1 August 4th 09 01:14 PM
Delete rows with no data Mindie Setting up and Configuration of Excel 1 November 30th 05 09:24 PM
Delete certain rows of data... RMJ Excel Programming 3 January 26th 04 08:30 AM


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