Dynamic Workbook path

Ruca13

Board Regular
Joined
Oct 13, 2016
Messages
85
Hello everyone

The purpose of what I'm trying to build is to get the price at a certain location and at a certain week.

For now my code is:

Code:
Sub Price()


price_path = Worksheets("Settings").Cells(1, 11).Value


'Workbooks.Open(price_path &


    Columns(50).Select
    Selection.Find(What:=Cells(ActiveCell.Row, 18), After:=ActiveCell, LookIn:=xlFormulas _
        , LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate


End Sub

Where the active cell is where I wanna put the price, the column 18 with the active cell row gives the day of the occurence, and I'm finding it in a table in which I have all the days of 2016, next the price week, and of this on separate columns: day, month, year, month in text (ex:jan), month in text2 (ex:January).

The first thing will be to open the correct file, that after the price path should be year\month year, and only after that is the file, which indicates the price week (a date that holds for the whole week) (ex: 2016\01 January 2016/FPI 01 Jan 2016.xlsx , which is way I have the months written in text, and the numbers part is formatted to read as 0#).

The opened file will have a list of locations, prices and suppliers.

After that, I want to find the location (activecell.row, col16) for which the price stands. The header for the location in the price files is cell B8, supplier M8 and price K8. If the price is NA but the location exists, a message will appear that no price is available (i think i need to *1 and use iserror).

Now for the two most complicated parts.


  • If the location does not exist is the opened file, then it must open the previous file, and so on until it finds the location.


  • If there is more than one occurrence for the location (two prices for the same location), I want an user form that gives me the option to choose the price and supplier I want

I'm sorry it's a bit of a mess and probably a lot of work, but thank you to whoever can help.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,214,636
Messages
6,120,669
Members
448,977
Latest member
moonlight6

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top