Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help to understand script
Can someone please tell me which part of this script refers to the columns.
Also, why it won't complile at line 3 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") res1 = Inputbox("Enter Minimum £ to Stay") 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 -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200510/1 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help to understand script
I copied it out of my posting and pasted it into a new module.
It compiled and Ran flawlessly - performing exactly as expected. 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 I have also changed column references to Letters for ease of adjustment If Cells(i, "A") < qty And Cells(i, "B") < pounds Then 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, "A") < qty And Cells(i, "B") < pounds Then Rows(i).Delete End If Next End Sub -- Regards, Tom Ogilvy "Crowbar via OfficeKB.com" <u15117@uwe wrote in message news:5655458949f7b@uwe... Can someone please tell me which part of this script refers to the columns. Also, why it won't complile at line 3 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") res1 = Inputbox("Enter Minimum £ to Stay") 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 -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200510/1 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help to understand script
Hello Crowbar, I ran your code on my machine using Office 2000 and Windows XP. I compiled and ran fine. What system and version of Office are yo using? Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=47894 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Gap or something I cannot understand | Excel Discussion (Misc queries) | |||
not understand | New Users to Excel | |||
I don't Understand | Excel Worksheet Functions | |||
< |
Excel Worksheet Functions | |||
Excel 2000/XP script to Excel97 script | Excel Programming |