I am working on a project to clear festival events with simulation. Therefore I need a grid of Excel cells (the field), let's say 11x11 (B2:L12). And the exit is in cell A7.
I am looking for an algorithm which fills this field with distances to the exit. For horizontal and vertical movements the distance is 1, and for diagonal movements the distance is 1.5
Say I made a class Coordinate which has two points, X & Y I declare a variable point, as the location I am in (the active cell) and a constant exit (the coordinate of the exit)
And then I would like a function in VBA which does:
I want to have them in order of shortest price (favourite) first with the relevant horse's name in the adjacent column. I have just discovered vlookup which seemed perfect - until I discovered that when there are two or more identical prices it only returns the 1st horses name.
Is there any way I can use vlookup to do this (with more than one identical value)
I want to use a User Defined name look up its corresponding X/Y Coordinates , reference a list organized by categories, then go through each name in the list finding each's X/Y Coord Calculate distance.
I have two to four columns with this content: w2s3esus who translated means 9 chars (the number before the letter is the time it appears). I want to compare the columns and pick the shortest one automatically like so:
I have a list of project numbers that is over 7000 rows long [example attached]. Many numbers are repeated. This list comes out of a financial reporting system. I need to extract a list of unique numbers in numerical order. I have two solutions working, one with SUMPRODUCT formulas and one with MACRO. Here's the MACRO solution. But it takes about 20 seconds to execute. I am just looking to cut down on execution time. I am using this macro a few times on different lists in the same program. Is there a better [faster] way to do this?
I am using an XY scatter chart that displays the planned path and an actual path as I go. The planned path is set up in 100' increments and goes 12000' and actual path varies along the way.
My data that I use is the Northing (ft), Easting (ft) and Vertical Section (ft) for both the planned path and actual path.
I was wondering if there was an east way to get that information from the chart or if there is a formula that would allow me to calculate distance between the two points by using the data I use for my chart.
This should be so easy, but I know I am missing something. I know that you can only create one directory on one statement line at a time with MkDir. in the "var_dir_path" resides a part number that changes dynamically.
Customer directory inside the "masterfile drive". Part number subdirectory of the Customer Directory. 5 subdirectorys of the Part Number Directory. 2 subsubdirectories of one of the 5 subdrectories. That is reference only.
Private Sub CreateFolderFromCellPath8_Click() Dim s1 As String, s2 As String, s3 As String, s4 As String, s5 As String, s6 As String, s7 As String, s8 As String, s9 As String, s10 As String var_path_masterfile_cust_name = Worksheets("RFQ").Range("AF48").Value var_path_part_number = Worksheets("RFQ").Range("AF49").Value var_path_Correspondence = Worksheets("RFQ").Range("AF50").Value var_path_Customer_Service = Worksheets("RFQ").Range("AF51").Value var_path_Engineering = Worksheets("RFQ").Range("AF52").Value var_path_Purchasing = Worksheets("RFQ").Range("AF53").Value var_path_Quality_Assurance = Worksheets("RFQ").Range("AF54").Value var_path_Sales = Worksheets("RFQ").Range("AF55").Value....................
The variables are grabbing the path directly out of cells in Excel that are concantenated strings. This works great if the customer folder (s1) is not created. I would have thought that the way that I had the If/Then setup, that it would run smoothly, but if the customer folder is already created, the Debug highlights the very first MkDir s1
I have a report that is collated from several other workbooks. The source workbooks follow the same naming convention throughout the year and so I have managed to concatenate the file path to bring through the text of the filepath and cell reference however cannot work out how to get the value of the cell. For example, I have the file path in A1, file name in B1 and sheet and cell referernce in C1.
I am using {=(A1&B1&C1)} which gives me R:CONFIDENTIALREPORT FOLDER[REPORT 24.09.07.xls]Sheet1!$D$1. To make matters slightly more difficult, the source reports would be closed. Is there an easy way or am I going to have to do this in VBA.
I have a variable ("DestFile") that defines a path to a file (used in saving the file)...
I'm in the process of getting a Sub to hyperlink to this file, but in some circumstances, I may only want to hyperlink to the folder, not the actual file...
How would I go about trimming the "DestFile" address to get a "DestFldr" address?...
An example of "DestFile" might be; S:BryanFor KenGulf ConstructionST0609014-t.xls (the file name length may vary) What code can I use to consistently trim it back to; S:BryanFor KenGulf Construction as the "DestFldr" variable?
Cell F9 looks at D9. If there is no value, I would like it to return "", if there is a value, I'd like it to finish the formula.
It figures the formula correctly, providing there is a value in D9. However, the entire D column is referencing cells from another workbook. So while no value shows up, if you click on an empty cell in D9 it says:
='C:Workbooks[EnterMenu.xls]Enter Menu Items Here'!D5
How can I get Excel to see 'visually' empty cells in the D column as empty when it seems Excel is reading the cell value as a reference path.
However, that diagnoses might be wrong, since if there is a value there, it figures the formula using the value and pays no attention to the reference path.
This is the formula I'm using currently: =IF(D9=0,"", IF(N(H9),H9/D9,G9/D9))
How to save a file, with file- name. but the directory is to be read in worksheet "towns" in Cell1 (brussels) and filename in worksheet "names" in cell B2 (i.e. winter), so it saves to c:russelswinter.txt as a wordpad or kladblok txt file, that keeps a number, so each time we push a button "go back from worksheet names to worksheet towns" the "number" that is saved in the txt document goes up by value +1. In Flemisch, the "old" code goes as follows, and saves the number in the txt file Factuurnummer7.txt. But I want that the file name (here: FactuurNummer7) can be a variable text issue, which has to be read - as already noticed - in cell B2 (with the word WINTER). So the are 2 worksheets: towns, ans names
pad$ = Application.DefaultFilePath 'controle = Dir(pad$ + "FactuurNummer7.txt") 'If controle = "" Then GoTo EerstAanmaken 'Open pad$ + "Factuurnummer7.txt" For Input As #10 'Input #10, Nummer1 'Close #10......................
How do I setup MyPath to a cell reference? In this case I need to set MyPath to the cell value of I1
Code that I have that doesn't work...
Sub SaveToFolder() 'Save File to Path MyPath = I1 ActiveWorkbook.SaveAs Filename:=MyPath & ActiveWorkbook.Name Windows("PE Console.xls").Activate End Sub
I'm using this code to import a file, but I want to be able to save just the path (with no file name) to a variable to use for the output file. This code saves the path and file.
Any help would be greatly appreciated. I didn't know but what there was a function that I could apply to the 'FileName' variable that would remove the file name...don't know.
I want to know how to index a drop down list to be used for calculations.
Up until now I was using
Range("B1").Select 'the cell where the drop down list is ActiveCell.Formula = SiteID 'site id
But for whatever reason it trims a trailing zero from SiteID when setting it in the second line. SiteID is a VBA string.
Indexing it would work, as would preserving the zero so help on either one is appreciated. Auto Merged Post Until 24 Hrs Passes;Correction, I lied. I was using this line to set it.
Range("B1").Select 'the cell where the drop down list is ActiveCell.FormulaR1C1 = SiteID 'site id
How can I get the name of a workbook WITHOUT the path when I have the name WITH the path?
To be more specific. When I use "Application. GetOpenFilename" the result is a file name for say "my_book" including the path. With this I can open the file using "Workbooks.Open" and Excel will show me "my_book". But when I want to reference this workbook later on in say "Workbooks(my_book)", then I need the file name without the path. How can I get that one in VBA?
Till now I was using "CurDir" to find out the path after opening the file and just subtracted it from the full file name. This seamed to be fine. But now I had a situation where CurDir gave me a path with abbreviations (~),
I'm trying to copy a file from one directory to another directory. However, the source directory, I'd like to have it so it's created from values within specific cells on a Sheet named "PULL".
When trying the following, I get an error permission denied.
I have the following code, taken from an example off the web. But I would like to change the save path to just C/: rather than copy the save path of the original file...I would also like to not close the active workbook that I am working in....how can i achieve this?
Sub TwoSheetsAndYourOut() Dim NewName As String Dim nm As Name Dim ws As Worksheet
If MsgBox("Copy specific sheets to a new workbook" & vbCr & _ "New sheets will be pasted as values, named ranges removed" _ , vbYesNo, "NewCopy") = vbNo Then Exit Sub
With Application .ScreenUpdating = False
On Error GoTo ErrCatcher Sheets(Array("Copy Me", "Copy Me2")).Copy On Error GoTo 0 For Each ws In ActiveWorkbook.Worksheets ws.Cells.Copy ws.[A1].PasteSpecial Paste:=xlValues....................