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).
I have a long customer listing, names 5 to 36 characters and several with their location in the name as well as a few common duplicate names. I am trying to produce sheet where the customers name once selected opens in the customers spreadsheet and data can be added/amended for sales etc.The lists are not in alphabetical order as when created a customer number is automatically allocated. My aim is just to type in the first letter of the name and the dropdown appears the customer is selected and their card appears. I have tried data validation, lookup, vlookup, Dropdown and Match/find. they only return the first record found and no sign of any others. Find returned all instances of the letter appearing in every name.
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.
=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]],"
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
I'm looking for one macro code in order to generate the excel files and give the standard excel file names.
Example: I have one master file in the given path like C:Temp and input box required to assign the number of file option. If I declare 10 files then my master file should get 10 copies and save it the above path....
I have 8 different workbooks which is 100% similar. Only values registred on each sheet is different. the format and rows/columns are the same.
The sheets is something that changes, when I want to improve layout etc. I have one Template book where I do the changes and try to export this to the other books (call it upgrades). For macro moduls it works nice, just replace.
The problem is the sheets. When I have changed a sheet, replace it, it would not adopt values from the other sheets.
Ex. In sheet 2 I have named the cell 'B60' for U_KU in the new sheet 1 I expect at using =U_KU in cell I7 would adopt the values from B60 in sheet 2. But nope.
I can see that there is an link to the template workbook in edit ->linkage. Would this cause problem?
Every month I work on an audit that has data from 35 different distributors. I have code below that puts each distributors audit/sales information on a new tab and each new tab is given the distributors name. This also creates a new workbook for each distributor.
When the new workbooks are created, how can I name each workbook with the distributor name it's being created for? Is it possible to predefine a file path to where these new workbooks will be saved?
The distributor names I'm using are in column AF.
Sub FormatList() 'The code below creates and names a new tab for each members info Dim ws1 As Worksheet Dim wsNew As Worksheet Dim rng As Range Dim r As Integer Dim c As Range Set ws1 = Sheets("Sheet1") Set rng = Range("Database")
'extracts a list of member or distributor names ws1.Columns("R:R"). AdvancedFilter _ Action:=xlFilterCopy, _ CopyToRange:=Range("T1"), Unique:=True r = Cells(Rows.Count, "T").End(xlUp).Row
'set up Criteria Area Range("U1").Value = Range("R1").Value
For Each c In Range("T2:T" & r) 'adds the member name to the criteria area above ws1.Range("U2").Value = c.Value ...............
The code below looks at file names in column A and then goes to a folder and opens and copies the data in range c2 -lastrow from each file and pastes the data into sheet2.
how I could add to the code so that it also inserts the file name in column c?
It would make it easier to track the data in column B.
VB: Sub CopyFromFile() Dim fPath As String Dim lRow As Long
I have attached a sample workbook. The list of file name is in sheet 1. An example of the output is in sheet 2. The data in column A is dummy data generally spans 100's of rows not just 10 as in the example.
The purpose of the code is to be able to put a list of file names in column a in sheet 1 and extract data from those files in a folder. The data extraction works fine. The reson for adding the file names is so that I know what file the data came from.
I am trying to enter only the named ranges in the active worksheet into an Array. The amount of named ranges can be from 4 to 7 per sheet.
I'm self taught at VB (This posts on this forum have taught me - thank you!) and have got the below code working on a Workbook - but not on a worksheet level. ActiveSheet.Names.Count returns nothing, changing to ThisWorkBook.Names.Count returns the sum of all .Names in the workbook.
Sub aTest() Dim sArray() As String Dim sJoin As String Dim y As Long
x = 1 y = ActiveSheet.Names.Count z = ActiveSheet.Name
Public Sub ListMyFiles() Dim fso As New FileSystemObject Dim fso_Folder As Folder Dim fso_File As File Dim file_count As Long
Set fso_Folder = fso.GetFolder("S:SHARED All of TransportationTraffic AssessmentMultiway Warrants") file_count = 1 For Each fso_File In fso_Folder.Files file_count = file_count + 1 Cells(file_count, 1).Value = fso_File.Name Next fso_File Set fso = Nothing End Sub This works great, but is there a way for the macro to recognize the file names that have already been added to the spread sheet and only return new ones that have been added to the folder?
Want to do something *almost* exactly like a previous post but that post is now closed. Extract Each Sheet To Text File & Save as Sheet Name .txt` I want to extract data from individual worksheets from a workbook in excel to individual text files with the **same name as the original excel file** plus incrementing suffix.
don't delete - this is not a duplicate post. Previous code 1) creates text files with "sheet name" as was the original post's intent (not "file name") and 2) it does not iterate through each sheet (only processes Sheet1 regardless of selected sheet in the workbook)
I have a database output file where one of the columns contains managers names, often more than once. I want to apply an autofilter on manager name and then copy the result to another sheet or sheets. My criteria for the autofilter is a variable pointing to a list of names that at present I maintain by hand; a for-each-next loop then cycles through the names.
What I would like to do, before running the autofilter code, is to create the list of names via code. This would then automatically pickup names that are missing.
The code I have so far is below:
Public Sub find_managers() Dim managers1 As Range Dim names1 As Range Dim n1 As Variant Dim n2 As Variant
In my mind it should check the names in the unique list against the imported list and add any missing names.
I have been given a list of my firm’s target clients (in excel) and an opportunities report (exported into excel) from our CRM system, which lists all the opportunities (i.e. opportunities to sell/provide products/services) that have been created for each client. Some of the column headings in the opportunities report are as follows:
Client; Opportunity ID; Opportunity Name; Opportunity Description; Created by; Date Created etc.
What I need to do is lookup each client, from the target clients listing, in the opportunities report to see whether an opportunity has been created; and if so, return the row of values (i.e. the Opportunity ID; Opportunity Name; Opportunity Description; Created by; Date Created) for that client. The result will be placed next to the name of the client in the target client worksheet.
I have a couple of problems. Initially I tried to use the VLOOKUP function to lookup the client name in the opportunities report and return the Opportunity ID (I then planned to use the same formula to return values from the other columns); however, as the client names in the target client listing were not always written the same way as they were in the opportunities report, the formula often returned #N/A. The formula I used was
So for example, the first client that I was looking up was written as “ABC Ltd” but in the opportunities report it was written as “ABC Limited”.
My second problem was that for some clients, there were multiple opportunities listed in the opportunities report. Where this was the case, there was a separate row (repeating the client name in the first column) for each opportunity created. I think that was messing up my VLOOKUP formula as well.
Is there a way to look up the client name, from the target client listing, in the opportunities report even if it’s slightly different and return the row of values for each opportunity created for that client on a separate row?
I have a complicated one here (at least for me)...
I have a very simple sample spreadsheet showing exactly how I'd like it to work but couldn't find out where to upload it? I can upload or send to you privately, if need be? May make it much easier to understand the desired end result.
I want to populate as follows:
Column A: "IN TIME" Column B: "NAME" Column C: "POSITION"
I have a date in cell D1 - today().
I need to search for that date in a column between range AA2 and BN2. When it finds the date (let's say it finds a MATCHing date in AA2), it will then search that entire column cells AA30:AA1920 and look for "server". When it finds "server" it will then grab the in time which will always be 4 cells directly above where it found the position ("server"), and then the name of the person, which will always be in column X, 6 cells above the position.
There will be multiple instances of "server", and I want to populate the columns A, B, C with all the servers it finds first for that day with their name, in time and position. then a blank row.
Then, I want it to find "Bar" positions using the same formula and method, and populate that right below the server data, then find "line", etc.
Ultimately, I'm trying to make a daily staffing plan, where all the people that are working on that date, it will show their in time, name, and position in columns, A, B, C as far down as necessary.
However, I'd like them auto grouped together by position, so I'd like the formula to somehow populate all the servers first, then all the bartenders, then hosts, then line, etc.
I have a list of names in a single cell. They are all seperated by a comma, then a space. Example would be: John Smith, Steve Wilson, Wallace O Malley, etc. What formula could I use to pull out the names individually, starting from the farthest right?
I'm trying to sort out a list of names from a website that publishes names in the following format:
DOE John VAN GOGH Vincent DA VINCI Leonardo NADAL PARERA Rafael JIMENEZ RODRIGUEZ Miguel Angel
What I'd like to do is get the names in the following format
John Doe Vincent Van Gogh Leonardo Da Vinci Rafael Nadal Parera Miguel Angel Jimenez Rodriguez
Basically all the last names - which are all capitalized - would be moved to the end of the text string. Of course any leading spaces should be removed and I guess using the Proper() function, all capitalized words could be capitalized in a standard way.
I found the following function, here: [URL] ...
but what it does is just take the capitalized words and separate them into a separate cell, which is not all of what I want.
create a script that will replace the names in column A on sheet1 from a Master sheet in the same workbook?
The problem is that different users are entering data on sheet1 col A in different ways example someone may enter Johnc or John C Or John What I want is for something to run down col A on sheet1 and look for the like name on the master sheet if the name matches then do nothing but if the name is like another name on the master sheet then replace the name if they are almost alike.
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)