Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
Gap or something I cannot understand MFS Excel Discussion (Misc queries) 1 August 26th 09 12:13 AM
not understand [email protected] New Users to Excel 1 February 24th 08 02:18 PM
I don't Understand elusiverunner Excel Worksheet Functions 6 November 25th 05 09:19 PM
<> Scooterdog Excel Worksheet Functions 1 November 8th 04 07:56 AM
Excel 2000/XP script to Excel97 script hat Excel Programming 3 March 2nd 04 03:56 PM


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