PDA

View Full Version : Help Getting Started (New Project)



LaBamba
06-17-2014, 09:38 AM
Hey guys...and maybe some girls out there! hah.

Great forum so far; hopefully it will be my go-to going forward =)

I know you will have questions as you dig into my project; but i want to give you the gist of it and see if you can provide some guidance.

I want to create a command file; a lookup file in a sense.

I want this file to contain criteria in which, when met, a certain action is taken in my open worksheet.

Both files will contain a unique number in which I could use for my Lookup. But its not just a simple lookup I want returned...I want the my current workbook to compare its information to my Lookup file and determine a value.


A simple example is: *My actual project will contain more variables*
My Lookup File will contain:
Item Number Price Max Quantity
12345 $50 100

The file in which i am working will contain Item Numbers, a price, a quantity, and also a quantity in which I return (this is where our value will go.)

I want my current workbook to compare itself to the data in my look up file....so if item number #12345 is in my current workbook it compare its data to my master. When the price is the same, and the quantity requested is lower than or equal to 100...it will return a value...either 100 or lower if the quantity requested is lower.

Let me know your thoughts guys.

Thanks in advance!!! you guys roxx!

ValerieT
06-19-2014, 07:46 AM
Beginner girly answer:


Why don't you just:
1° ensure the columns are the same in both files, or set the relevant ones into constants (i.e ColID =1 for Column corresponding to the ID)
2° find the Master.raw corresponding to your Command.ID
3° then proceede to whatever you have to do?

exemple (just to show the idea):



for i = 2 to 999999 (scan all rows)

'find ID in master
Set Found = Nothing
Set Found = Sheets("Master").Columns(ColID).Find(What:=Cells(i, ColID), LookAt:=xlWhole)
On Error Resume Next
Working_row = Found.Row

If Sheets("Master").cells(Working_row,ColPrice) = Sheet("Command").cells(Working_row,ColPrice) then
if Sheets("Master").cells(Working_row,ColQuantity)- cells(Working_row,ColQuantity) >0 then
Cells(Working_row.ColResult)=cells(Working_row,ColQuantity) ' get lower command
else
Cells(Working_row.ColResult)=Sheets("Master").cells(Working_row,ColQuantity) ' get 100
else
...
endif
next I

Bob Phillips
06-19-2014, 08:07 AM
At the very least, I would think


Working_row.ColResult

should read


Working_row, ColResult

ValerieT
06-20-2014, 12:16 AM
Yeap sorry.. wrote it too quiclky at the same time I was talking on the phone

Aussiebear
06-20-2014, 01:46 AM
LOl..... multitasking again huh?