Automatically Select Most Latest File Name From Similar Names Ending With Dates
May 25, 2014
I need to use the VLOOKUP feature from the most latest files, I am using VLOOKUP in VBA code which is working fine, however the problem is that the files from where I do VLOOKUP are added randomly in a week.
Ex:
There are 2 Files, 1st File where the data would be looked up from the 2nd File, Now the 2nd File has names like this "Offline Data as on 10th May 14", "Offline Data as on 13th May 14", "Offline Data as on 23rd May 14", etc.
Now these files are send by another department, and each time the most recent data has to be searched from these files.. All of these files have to be maintained separately for record purposes.
Hence in the VLOOKUP, Lookup file keeps on changing...so is it possible to make a code in such a way that the code picks up the most recent file for reference, from the above example we would need to pull the data from the most latest file which is "Offline Data as on 23rd May 14" , if any other file is added in that folder more recent than the one mentioned than the code should automatically link it to that file.
I have managed to codify the lookup but due to this filenames being changed always I have to do this manually..as this has to be done at several columns in several sheets its extremely time-consuming.
So, logic code to pick the most recent date which is embedded in the filename...
View 12 Replies
ADVERTISEMENT
Mar 4, 2008
How would I save a file with the lastest version number after searching for the lastest filename in a folder and adding 1 to the name
ActiveWorkbook.SaveAs FileName:= _
"C:BarkingEMCOUTNOM_DA_" & (Format( Date, ddmmyy)) & "_EDF_BPL_" & V, FileFormat:=xlCSV
where V will be the version number in the format of 001, 002, 003 and so on
View 7 Replies
View Related
May 9, 2014
I have attached an example sheet : LATEST.xlsm
To sum up - need a drop down box - that when "flange" is selected - It opens a file automatically - no clicking etc. just when that option in the drop down box is chosen.
[Code] .....
But doesn't work, plus means I have to click on something.. etc
View 7 Replies
View Related
Feb 21, 2008
As you can see in the example below, in column B I have a list of vendor names, some of which are similar but not identical. (For Example, in one instance a vendor will be called "Ford Motor Co.", while in another it will be called "Ford Motor Inc.".
I need to populate column C, which at every instance where two plants (listed in column A) have similar vendor names in Column B, a universal name will be assigned and recorded in column C for each of the similar names.
HOpefully it is clear as shown below.......
As you can see in the example below, in column B I have a list of vendor names, some of which are similar but not identical. (For Example, in one instance a vendor will be called "Ford Motor Co.", while in another it will be called "Ford Motor Inc.".
I need to populate column C, which at every instance where two plants (listed in column A) have similar vendor names in Column B, a universal name will be assigned and recorded in column C for each of the similar names.
HOpefully it is clear as shown below.......
View 9 Replies
View Related
Jun 10, 2014
Sheet 1 is filled with names(column C) and dates(column X). On the sheet 2 I want the latest date for each names. I tried the below formulas. But it is not working.
=IF(ISBLANK(EWS!$X$2:$X$101)," ",MAX(VLOOKUP(Lookup!$D2,EWS!$E$2:$X$101,20,0)))
= MAX(VLOOKUP(Lookup!$D2,EWS!$E$2:$X$101,20,0))[code]....
View 7 Replies
View Related
Apr 9, 2014
I have developed a user form in VBA which is used for entry into an excel worksheet. From this data, I need to do the following:
1) Create 2 output files for Job data entitled "J" and another file entitled "S". The "J" and "S" is captured in a field in the data. I need to hit a button that allows these 2 output files to be produced, so I need to 'loop' through rows of the data to do this/
2) In addition to 1), the user needs to be able to 'select' the date range they would like to see 'J' and 'S' data over. This will be based on a field called "Startdate'. How could I do this with the button above-can I parse an input value to a form and select the 'J' and 'S' files on this.
View 1 Replies
View Related
Aug 26, 2013
I have a macro that copies three sections of data from a word document and pastes it within the Excel worksheet. The column of data is pasted in a single column (data to be space-delimited and evaluated later), and what I would like the MACRO to do is separate the three sections of data based on the starting and ending values of the section and place them in different columns.
Section 1 : starts with the word "Team"
Section 1 : ends with the word "City"
Section 2 : starts with the word "Location"
Section 2 : ends with the word " Date"
Section 3 : starts with the word "Member"
Section 3: ends with the word "Age"
So section 1 would be pasted into cell C1, section 2 pasted into G1 and section 3 pasted into J1.
Each section will have vary in number of rows between the starting/ending values, so to cut and paste the section based on the starting and ending value is vital.
View 7 Replies
View Related
Oct 14, 2009
I have tried looking for similar questions in the forum and couldn't find them. If you know of any, please let me know. My problem is that in one column I have peoples names that are repeated. I need to average numbers that are in the same row as their name. So for example:
NameDateworkPagesRevisions Revisions/PageRH9/16/09Sandy land39320.82Bryce9/18/09Price mixed use1111030.93Bryan F.9/21/09Letter (rates)6325.33Bryan F.9/21/09Bountiful Nursery64871.36Randy9/22/09SJ Subdivision58220.38RH9/25/09Park City office Condos76881.16Bryce9/25/09Evanston Motel62210.34
this list is continually added upon monthly. So for Bryce I would be able to pull 111 and 62 and have an average of 87.5 from the pages column. But if I were to add another row farther down with his name, it would change the average.
I was thinking that a repeated vlookup would work if it stopped when there was a blank in the cell, but I am unsure on how to do this. If you have any questions, let me know. I was hoping to have it in a formula in a cell above the table.
View 9 Replies
View Related
Feb 17, 2013
Basically I have a list that user can select up to 6 values from. I have set them as individual strings.
Code:
Public IH1 As String
Public IH2 As String
Public IH3 As String
Public IH4 As String
Public IH5 As String
Public IH6 As String
What I want to be able to do is loop through them and do certain actions. How can I get a for statement to do that.
I tried something like that but it doesnt work. How to get it working I need to do tests on the variable strings and I want to be able to reference them and I'm not sure sure how
Code:
For i = 1 To 6
If "IH" & i = vbNullString Then
Else
MsgBox "IH" & i
End If
View 3 Replies
View Related
Sep 17, 2013
I am working on a customer report template that generates our customers reports and will send them out automatically.
This issue I have now is that the system that generates the raw data for these reports only lists the Customers name in a column with an entry for each line of data, the thing is though that the system has lots of variations of the customers name, even more so if that customers has different departments.
What I need to do is from this list of customer names, I need to automatically figure out what the "common" name is or main name so to speak, and then make a variable using the correct full name, which will be used later on in the code to import correct logos, and direct the reports to the correct people.
Here is a quick example of what data we get raw from the system:
Customer Name:
John Build
Johns Buildings
Johns Ltd Building
Johns Plumbing Department
Glass Doors Ltd A Department of Johns Buildings
Johns Building Corporation
Hole In One Golf Range
This is just an example, we have thousands of clients, so the length, number of words etc can change alot. Ideally I from a list similar to that I would get a full proper result of "Johns Buildings Ltd" for example, this would then be in a variable to be used in code from then on to reference doing certain things with the reports of Johns Buildings Ltd.
You'll notice there is one name "Hole In One Golf Range" that seems to have no relation at all, this is correct, ideally I would also like to build in some error checking into the code, so that rows like that that have nothing to do with the others would get deleted.
So how would you amazing VBA gurus go about working with data like this? I'd prefer a more general answer with explainations that just straight code, as I'm sure I will have to adapt the hell out of it for it to be useful in context.
View 9 Replies
View Related
Jan 29, 2014
Magazine subscription list. How to highlight the customers that are already in the sheet if enter them again (renewal). Our list is like so....
ColA ColB ColC ColD ColE ColF
First Last 123 Ave City State Zip
Is there a way to highlight the row if the info on ColA, ColB, ColE, and ColF all match? Sometimes the Street info is abbreviated or entered PO Box instread of P.O. Box and they wind up on the list a second time.
View 5 Replies
View Related
Mar 4, 2014
I have a table as below, and I would like to keep only the latest date for each EMP_NO. For example:
001VICE PRESIDENT A062004-01-01
031SENIOR VICE PRESIDENTA042004-01-01
...
....
....
=======================================
[EMP_NO JOB_TITLE DEPTCHANGE_DATE
014 ASSISTANT VICE PRESIDENT A01 2004-01-01
001 MANAGER A062000-03-01
001 MANAGER A062001-06-01
001 VICE PRESIDENT A062004-01-01
076 VICE PRESIDENT A022003-04-23
013 DIRECTOR OF MARKETING A01 2000-06-19
031 FIRST VICE PRESIDENT A042002-01-01
031 FIRST VICE PRESIDENT A042003-01-01
031 SENIOR VICE PRESIDENT A042004-01-01
=======================================
View 5 Replies
View Related
Jan 4, 2009
I have a workbook with two sheets.
Sheet1 contains details of all of the jobs I do.
Sheet2 is my customer list.
Customers appear only once in sheet2, but may appear mutiple times in sheet1.
In sheet1 I have customer name, lead date, job date et al.
In sheet2 I have customer name, first date, last date et al
I am trying to populate first and last date in sheet2 from the lead date and job date in sheet1.
Sheet1 has a range of 500 jobs
View 9 Replies
View Related
Oct 4, 2011
Based on the table below, I need two tasks.
1. Sort out the data descending for dates
2. Have a way so that I can only retrieve the latest information.
Meaning if I ask for Pen, I should only get a value of X
Similarly for XYZ, I should only get a value of N
Date A B Types
Value 5 Oct Pen X 5 Oct Pencil Y 5 Oct Pencil H 4 Oct Glue
Q 1 Oct
Pen N 27 Sep
Glue T 2 Sep
XYZ N 2 Sep
XYZ X
View 4 Replies
View Related
Apr 3, 2009
I've adapted a spreadsheet to automatically update the latest results.
But my formula (D11), that I got from here, has now stopped working.
I suspect this is due to the formula I've used columns H and I. But I have no solution.
Also the very similar formula used in M15 to M44 has also stopped working, probably for the same reason.
View 3 Replies
View Related
Apr 10, 2014
I have an excel file with the ID, Name, workID and Creation date fields. Some people have several work ID's created in different times. How can I select row that contain work ID's that were created the latest. I may have several records per person, I need only the latest record. File contains about 3000 records, I can't go through all of them.
View 9 Replies
View Related
Apr 1, 2013
I have problems with my project. I want to filter data between two dates with customer ID and when click Export Report button , result will copy on next sheet ( sheet's name is report in my file attachment ) and auto sum similar products.
eExample_report.xlsm
View 1 Replies
View Related
Feb 7, 2014
I'm trying to pull out the earliest and latest dates associated with a text string in a workbook.
Min Max dates example.xlsx
i.e. in this example, I want one column to display the earliest date associated with DU 145, and the next column to display the latest.
From what I understand, I need an array formula to do this and have written the following, which works:
=MIN(IF($A$2:$A$6=A2,$B$2:$B$6))
(confirmed with CSE) - and the same for MAX.
Where I'm struggling is that DU 145 may be entered in the workbook as DU145, DU 145 or DU-145 and I need to take all of them into account. I tried:
=MIN(IF($A$2:$A$6="du*145",$B$2:$B$6))
As this works in a COUNTIF formula in the same sheet. But this just returns a date of 00/01/1900. I'm new to array formulae & haven't really worked them out yet. Is there a way to do this? I assume it's something to do with the way I'm entering text as removing the wildcard * makes no difference.
View 4 Replies
View Related
May 9, 2013
I am trying to create a macro using the recorder that will select the latest date in a drop down list. The dates upate each day in the pivot table after the table is earlier refreshed. Using the recorder simply picks the same date each time. I want it to select the latest date. Am using Excel 2010 and have some very limited experience in vba for editing macros.
View 1 Replies
View Related
Nov 13, 2013
I have a raw data in one file and then another file contains pivot table linked to the raw data. In the dashboard i need to show last 6 weeks trend which is linked to the pivot table. Currently i am manually unselecting previous week and selecting the latest week.
Ex: This week i select weeks 5, 6, 7, 8, 9, 10 from the pivot for the dashboard. When new data is updated next week, i want to select 6, 7, 8, 9, 10, 11. I cannot delete as i need the historical data.
I am using Microsoft Excel 2010.
View 1 Replies
View Related
Jan 22, 2014
I need to create a function that selects 4 names randomly from a list of 15 names and displays the 4 randomly selected names in the one cell. Also, you cannot repeat the same name in that cell, (i.e. bob cannot be selected twice in his group of four)
View 1 Replies
View Related
Jun 13, 2008
I have a task I would like some assistance with…
I have a work book that I have to copy over 70 times for over 70 work locations. As you can see, this will require different file names for each location.
I would like some have help with a code that I can use. If possialbe I like a code that will make copies of the file renaming each with the names I have on another list. Is this feasible?
View 9 Replies
View Related
Oct 10, 2007
I'm trying to automate an Excel macro. I need a way to select the latest .txt file from the Import Data dialog box.
I currently have a "CHDIR" at the beginning of the macro that sets the active directory. When I make the "Import Data" pick I am in the proper place. Now if I can only sort the list of .TXT files by date, select the first file in the list and hit ok to continue I'd be off and running.
View 5 Replies
View Related
Aug 1, 2014
I'm using a macro to open an other excel file to get data from it. this goes by Workbooks.Open Filename:=totalopen (totalopen =Filepath & filename earlier defined) Because the opening file can have the same filename, my question; is it possible to open the latest/newest saved file? So also look at the saving date/time of opening excel file.
View 5 Replies
View Related
Feb 29, 2008
I have manged to search for the last updated file on a folder but i want to use the filename as the source for a copy and paste. it all seems to work bar the linking of the 2 processes the error message 'run time error 9 subscript out of range' is the file is already open should it just not use the same variable to copy the files?
Option Explicit
Sub Get_Availability_Data()
Application. ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Dim wsTo As Worksheet, wsFrom As Worksheet
Dim myDir As String, fn As String, a(), n As Long, myFile As String
Dim myDate As Date, temp As Date
myDir = "C:BarkingEMCIN"
fn = Dir(myDir & "*.csv")
Do While fn <> ""
temp = CreateObject("Scripting.FileSystemObject").GetFile(myDir & "" & ................................................
View 9 Replies
View Related
Jan 4, 2013
I have a worksheet with many tables that I use in formulas.
I like tables for a couple reasons, one being the ability to insert/delete rows without affecting the rest of that worksheet row.
Also, automatic copy of formulas/formatting is great.
But, what I really like about tables is the ability to use the naming conventions in formulas.
Problem is when I save this worksheet, after I close it and open it back up, all table references in my formulas have been converted to cell references.
Example:
Code:
=IF((SUMIF('Quote 1'!$M$28:$M$43,">"&'Quote 1'!$J$57:$J$60)*'Quote 1'!$G$57:$G$60)+(COUNTIF('Quote 1'!$M$28:$M$43,""&'Quote 1'!$J$57:$J$60)*'Quote 1'!$G$57:$G$60)+(COUNTIF('Quote 1'!$M$28:$M$43,""&tblOSSRV[Min Order Cost])*tblOSSRV[Cost / Part])+(COUNTIF(tblFam[[#Data],[Qty by Factor2]],""&tblOSSRV[Min Parts Per Line])*tblOSSRV[Cost / Part])+(COUNTIF(tblFam[[#Data],[Qty by Factor2]],"
View 4 Replies
View Related
May 1, 2008
Two part question:
1) I'm relatively new to arrays, but what I need to do is generate a list of file names and the sheets within each one. I would like to use an array for this, but since I don't have much experience.... well....that's why I'm here. Can someone point me in the right direction?
2) And the second part of this.... I was planning on using the FileSystemObject to determine the files in a selected folder and loop through that list of files, opening each one and harvesting the required info (file name and all sheet names). Should I use the FSO or is there something built into Excel that might be better (and also limit the number of dependencies for this little "project" of mine).
View 9 Replies
View Related
Mar 5, 2013
I am using excel 2010 on windows 8. I load a file which has been sent to me via e-mail and save it with an upgraded name, I then do a large amount of data input and save the file again, I do this regularly and even test load it at times to check it has saved, finally I save and close the file and then on reloading I discover the version I have is the first one I saved! all the work I have done on it has disappeared! I also sometimes find random .tmp files with non-sensical names in the folder to which I have saved, but I do not have the rights to open these .tmp files.
View 2 Replies
View Related
Jun 17, 2007
I have a sheet with a date and the number of months on it which will change. I need the sheet to list the dates in a column for each month automatically: e.g. Two cells contain date “jan07” and the period “10” months. The rows A1 to A10 should have jan07…jan16 listed automatically. If I change then change the number of month to 11 I would like the rows A1 to A11 to update automatically.
View 6 Replies
View Related
Dec 10, 2008
I need to make this macro read FOLDER names instead of FILE names. When I posted this question yesterday to get this macro, I wasn't told that each file in its own folder. I need the folder names now.
_____________________________________
Sub test()
With Application.FileSearch
.NewSearch
.LookIn = "C:Ford"
.SearchSubFolders = False
.Filename = "*.*"
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Cells(i, 1) = .FoundFiles(i)
Next i
Else
Cells(i, 1) = "No files Found"
End If
End With
End Sub
View 9 Replies
View Related