Create Folders VBA
I m having difficulty combining code to do this; create folder in network drive from excel list
T:Bob
Then subfolder T:BobFinancials
Then subfolder T:BobSecurity
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
Create Folders With Dates
I have a silly little sheet that i am trying to create to help me create a lot of folders on my pc. The sheet will basically make a consecutive group of folders that list out a 7 day period and a week number. The problem i am having is trying to paste the special values of the dates in a group of cells, and then using those values to create my multiple sets of folders. I do not know how to get around it using the 5-digit date codes when it creates the folders.
View Replies!
View Related
Create New Folders In Variable Location
I would like to create new empty folders from the list in column B. The number of folders will vary depending on how many entry in column B. I need the folders to be created in an existing folder in the "current directory" called "Shop_Drawings". The following code may be able to be modified. Sub CreateFolders() Dim MyFile As String Dim sDir As String Dim rng As Range Set rng = Sheets("Matdata").Range("B2") While rng.Value <> "" MyFile = rng.Text sDir = "CurDirShop_Drawings" & MyFile ''above is where I am having trouble...don't know the correct syntax'' MkDir sDir Set rng = rng.Offset(1) Wend End Sub I have attached a sample workbook. I have been getting by with code which requires changing the destination in the module whenever making folders in different diectories or drives.
View Replies!
View Related
Create Folders Named As Cell Text
I have attached a workbook that creates new folders based on text in a cell. As you can see when the button is pressed it runs the macro which when it is done calls the next & so on. What I would like to know is there a way of acheiving the same results with a single macro. Eg column A contains 4 cells with text. The macro when run will check for cell content then create folder based on that text macro will stop when next cell is empty.
View Replies!
View Related
Search Folders And Create Hyperlinks To Files
I have a list of file names sans extension in column A. I want to search a folder I specify and if file is found create a hyperlink to said file either in a new cell or in column A. The code I have does the search fine, but its hyperlinking is offset and I can’t get it to match the link to the file name. Also it breaks if it can not find the file. Here is the code...
View Replies!
View Related
Create Folders & Name By Cell List
way to create a group of folders in a specific location using a list of cells from an XLS file as the folder names. For example, it would take whatever text is in Cell A1 and create a new folder in a specified location. It would take the text in Cell A2 and create a new folder in the same specified location. Etc.
View Replies!
View Related
Create Macro To Rename Worksheets In Other Folders
I have created an appointment schedule spreadsheet. Once I get the spreadsheet running smoothly, I would like to create a worksheet for every day of the year that we are open. I have decided to have one main folder with 26 subfolders in it. In each of those 26 subfolders, there will be one workbook with 12 worksheets in it. That will be two weeks worth of appointments as we are open Mon-Sat. Of course I want to name the worksheet tabs at the bottom of the workbook according to the appropriate calendar date. Then there is also a cell at the top of each page that also has the date, the same as the date on the tab. Just wondering if there is a simple way to create a macro to rename all these worksheet tabs, or if I have to physically open up each workbook, and rename all the worksheet tabs according to the calendar date. Then once the worksheet tab is named, can you make it automatically put the same date into Cell A1?
View Replies!
View Related
Create Folders & Copy Files To It
I need to create a macro that will allow the user to create a directory based on a template directory, with all directory paths/ names stored in workbook cells: 1) Create a new directory (name/path specified in workbook) 2) Go to a template directory & copy the entire directory, subdirectories & all files 3) Paste them into the new directory 4) Save a copy of the workbook into the specified location from (3) Example: X:Templates -copy all to- X:Projects(Value specified in workbook cell)
View Replies!
View Related
Consolidate Data From Multiple Files Within Folders & Sub Folders
I have managed to get this far - I have put together a macro (from different threads on this site) that opens closed workbooks, copies data in one of the sheets (same sheet in each of 28 books), and pastes the data it into a master book sheet, each paste starting below the last. So that bit is working. The first bit of help I need is a line of code that will make the macro loop through a number of sub folders in a main folder. My code at the moment works as long as I specify a path that ends with the name of one subfolder, and it only loops through this subfolder. I would like the path to end at the folder that holds all the subfolders ('Workbooks' in the path below), and then add some code that tells it to apply the macro to all subfolders in this folder, so it loops through them all. The second issue is that after the macro goes to the closed book(s), copies the data in there and pastes it into the master sheet (into columns E:FG), I then need it to go back to the workbook it just copied from, go the same sheet, to three specific cells on that sheet (FH1:FH3), copy the content, go back to the master sheet, and now repeatedly paste the content (values only and transposed) of these three cells into three cells (in columns B:D, with row number being dependent on what rows the first lot of data was copied into) next to every row it just previously pasted in for me. When it loops to the next workbook, it needs to do the same, and the three cells will have different content than the ones in the previous workbook paste. I dont know how to define the range it needs to paste into the second time. I tried using the definition I used for the first paste (MCDrow), to tell it that it is the same rows, just different columns, but this is not working. Here is what I have so far, which does the first part of what I need, except for needing a way to have it loop through all subfolder in the 'Workbooks' folder (at the moment it lists Barwon South West as a subfolder in that path, but I actually have multiple subfolders, not all called Barwon South (all different names) that it needs to loop through and do both the first and the second paste for. I have taken out the code I was trying to use to do the second paste, as this was not working and the code is pretty messy as it is (I sort of bumble along, being so new, and I know the code is not very clean or efficient!). Can someone help me put in the few lines I need to loop through all my subfolders (if you give me an example I can probably extrapolate), but to get you started, three of the subfolders are Barwon South West, Eastern Region and Gippsland. And can someone help me put in the code that will do the second paste for each workbook? Sub Click2() Application. ScreenUpdating = True Dim MCDrow As Long 'Dim SubFolders As String MCDrow = ThisWorkbook.Sheets("Client Data").Range("A65536").End(xlUp).Row Fpath = "Q:Clinical ServicesCS Statewide DatabaseWorkbooksBarwon South West" ' change to your directory 'SubFolders = True Fname = Dir(Fpath & "*.xls") Do While Fname <> "" ThisWorkbook.Sheets("Client Data").Unprotect Workbooks.Open Fpath & Fname Worksheets("Client Data").Activate Worksheets("Client Data").Unprotect
View Replies!
View Related
Listing Folders With VBA
I have found a lot of posts which show me how to list a directory tree in an Excel file, usually using a macro. I'm just uninitiated with VBA / VBS and simply don't have the time to figure it out now (it really isn't part of my job description... I'm rather doing a favor here). I need to be able to re-generate an excel-based list of clients at will. The client names are subdirectories of different case types. There aren't tons of case types, right now maybe 20 but I need to be able to add case types without breaking the script. case_typeslast,_first_name........
View Replies!
View Related
Saving To/creating Folders In VBA
I'm trying to save a spreadsheet using VBA which will also check that the directory exists and create it if not, all based on cell values in my spreadsheet. When I run my code it comes up with Run Time Error 76: Path not found. Dim fname As String, dname As String, dname2 As String fname = ActiveSheet.Range("E2").Value dname = ActiveSheet.Range("G2").Value dname2 = ActiveSheet.Range("H2").Value Windows("Register Template.xls").Activate ChDir ("H:") If Len(Dir(dname2, vbDirectory)) = 0 Then MkDir dname2 End If ChDir dname2 ActiveWorkbook.SaveAs Filename:=fname
View Replies!
View Related
Using VBA To Create VBA Code On The Fly
I have a vba module that reads a value from a txt file and saves that value in a variable called "iniInfo". I want to permanently assign that value programatically by using VBA code to create a Public variable e.g. "PUBLIC CONST conFIg = iniInfo" in my modGlobalVar Module. (Of course, this would only create the code if the "conFig" variable doesn't already exist.)
View Replies!
View Related
Create Graph Using VBA
I want to create excel graph using VBA and found difficulties on chart name set to default. the script is like this : ActiveSheet.ChartObjects("Chart 31").Activate Can I set my own name of the chart instead of "Chart 31" (excel default) ?
View Replies!
View Related
VBA To Create New Sheet ...
I would like to be able to have a macro, linked to a button, so that when you press that button it creates a new named sheet based on data in a particular cell. I.e. There is a table with the following data: Apples (A1) Oranges (A2) Pears (A3) There are also the sheets Apples, Oranges & Pears. You enter 'Grape' in cell A4, then when you press the button it creates a new sheet named Grape. Also when a new sheet is created, the 'input cell', in this case A4, is moved down one so that when the next sheet is needed to be added, it doesn't just add the same sheet (i.e. in the example above, we don't end up with a new sheet named 'Grape' each time we click the button).
View Replies!
View Related
Create Tag In VBA?
I found this really cool code that creates a tag cloud in Excel using VBA. It's far too complex for my understanding but I was hoping I could get some of the experts opinions on here about modification possibilities. I have attached the macro-enabled 2007 workbook. What I am trying to do is search through a list of keywords and determine each keyword's density within a list. The list for example could look like this: slow windows xp windows xp running slow windows xp computer [slow windows xp] [windows xp running slow] [windows xp computer] [computer running slow windows xp] "computer running slow windows xp" "slow windows xp" "windows xp running slow" "windows xp computer" You'll notice the characters " [ ] of which I would like to ignore when the cloud builds. The cloud would list the most dense keywords first, and gradually decrease to the least dense keywords. The macro code is inside the workbook but I'll list it here to:
View Replies!
View Related
Create VBA InputBox
I am trying to create an inputbox using code from this site: Sub NumericDataType() Dim lNum As Long On Error Resume Next Application.DisplayAlerts = False lNum = Application.InputBox _ (Prompt:="Please enter you age.", _ Title:="HOW OLD ARE YOU", Type:=1) On Error Goto 0 Application.DisplayAlerts = True If lNum = 0 Then Exit Sub Else MsgBox "You are " & lNum & " years old." End If End Sub I get an error on the first line that says, "Compile error: argument not optional".
View Replies!
View Related
Create Comparison Code In VBA
I have to do monthly comparisons of two excel worksheets, one being a vessel timesheet and the other being an excel download from manpower software that we use. The comparison that is being made are days of the month, whilst the unique identifier between the two sheets (To make it easier to understand I will call them sheet1 and sheet2) is an employee ID. Both sheets, alongside the name and employee ID, list all the days of the month that employees have worked. If they have worked, there is a "1" under that day, if they have not the cell is blank. What I currently do manually is: 1: Search for the employee ID (and/or name) in sheet1 and compare the days with the employee ID in sheet2. 2: Highlight the differences 3: Move onto the next employee ID All differences are highlighted in sheet2. Differences highlighted are in the days only, where if any days are missing/extra in either sheet, then the particular cell(s) are highlighted in yellow. If an employee is missing from sheet1 but is in sheet2, then all the days are highlighted (in sheet2). If an employee is missing from sheet2 but is in sheet1, then that particular employee is copied to the bottom of sheet2 (after last row). As this is horribly complicated to explain, I can attach an example if this is sounding rather inexplicable? Is it possible to attach a xls to a thread?
View Replies!
View Related
Create A New Workbook By Vba Of Excel
I want to the following steps to be done by vba of excel. 1. copy ranges of cells in the active worksheet (sheet3) 2. add a new workbook and paste the copied ranges to sheet1 3. save the new workbook with the new file name (e.g. date) 4. close the new workbook and clear the contents the copied ranges of cells in old workbook. following code and make it more simpler? Worksheets("Sheet3").Activate If Range("l1").Value <> "" Then Range("l1").Value = CDate(Date) End If asdate = Range("l1").Value 'date entered by user resp4 = MsgBox(" Case particulars of " & asdate & " will be backed up and deleted from this sheet! Proceed? (Y/N)", vbYesNo, "Deletion of Data") If resp4 = 7 Then Exit Sub
View Replies!
View Related
Vba To Create A New File From Spreadsheet
I have the following spreadsheet: A-------------B File No.-----PRODUCT TYPE 123456-----NDT 123456-----NDT 123456-----NDT 123456--------- 123456--------- 789110--------- 789110--------- 789110--------- What I need is if there is an NDT in Column B and 123456 in Column A then I need to eliminate all rows which contain 123456. End result A 789110 789110 789110
View Replies!
View Related
Create Outlook Appointment From VBA
I am probably overengineering my macro, but I would like to setup an outlook appointment in two peoples calendars from my userform. The macro has access to the email addresses of the selected persons, I just want to send date/time and subject.
View Replies!
View Related
VBA To Create A New Folder From A Textbox Value
I don't know if anyone has tried this but it possible using vba to create a new folder in a directory from the text of a textbox? I have made a userform that I use to collect a persons first name & surname. I then created a folder in a directory manually (e.g Z:spnzphotos) I then scan their photo and place it into the folder. Is it at all possible to have a piece of code that once I press a command button is creates folder ready for me to add the photo to?
View Replies!
View Related
Files Within Sub Folders
I am using the code below to list all files within a specific folder however I need to know about ALL the files within the underlying sub folders (of which there are many). I have tried wildcards when declaring the folder but it does not work. Sub List_Files() Dim fsoObj As Object 'Scripting.FileSystemObject Dim fsoMapp As Object 'Scripting.Folder Dim fsoFil As Object 'Scripting.File Dim sFolder As String Dim i As Long Dim filtype As String sFolder = "V:T-ASSETAsset ScotlandNetwork Capacity Section1 Business Plan" Set fsoObj = CreateObject("Scripting.FileSystemObject") 'Set fsoObj = New Scripting.FileSystemObject........................
View Replies!
View Related
Opening All Folders
I have about 20 plus workbooks in a folder. Each has 52 sheets, Fridays date, that I want to copy all the data from each sheet. Is there a way to open all workbooks in a folder and copy all data from on all the various sheets into a single workbook? I'm trying to gather the info and make a small data base from the various books. I'd like not to have to call each workbook by name as the file names change or get added to.
View Replies!
View Related
Vba To Create Separate Reports From Master
I have the following spreadsheet Columns on master sorted by Column J: A--------------E-------------J SUPPLIER----CARRIER------LOC CODE BELGIUM-----HAM-----------BP HYDRO-------MSC-----------BP DAINIPPON---NNR-----------BP BELGIUM------YM-----------BR BELGIUM------YM-----------BR HYDRO-------MSC----------CA BELGIUM-----HAM-----------CA HYDRO-------MSC-----------CA HYDRO-------MSC-----------DE DAINIPPON---NNR-----------DE BELGIUM------YM-----------DE BELGIUM------YM-----------DE What I need too do based on the Codes in Column J is create a separate workbook for each different code.
View Replies!
View Related
VBA Macro To Create New Worksheet, Charts, Etc.
I need a macro to create the following worksheets and charts from an Excel data set: Three (3) worksheets (already created manually in attached Excel file): 1. Chart Data. (a) Column A in Chart Data is always numbered 1 - 600 (50 years x 12 mos/yr). (b) Column I and column Y data sets (from Prod_Month) created in Chart Data. Each data set can be identified and collated with column F in Prod_Month (API) which is unique for each dataset. 2. Rate vs. Month - plot of Daily Gas (col. Y in Prod_Month) vs. Months (col. A in Chart Data). 3. Rate vs. Time - plot of Daily Gas (col. Y in Prod_Month) vs. Calender Time (col. B et. al. in Chart Data) At a minimum, could someone help me create the Chart Data worksheet from the data in PROD_MONTH? Charting all the columns takes time from Chart Data but any data manipulation macro(s) help.
View Replies!
View Related
Can VBA Create A Named Sheet In One Step?
My vb code currently creates a new sheet via "Sheets.add". This new sheet has the default name of "sheet1" which I rename as "tempSheet". I then populate tempSheet with data, save as a CVS file and then I remove tempSheet. If I stay in my workbook and try to execute the code again, the default name of the sheet it now creates is "sheet2" and not "sheet1" - this is a problem becuase my code is trying to rename "sheet1" "tempSheet" and of course it cant.
View Replies!
View Related
VBA - Create Outlook Message With From-field
I have two question for Excel in combination with microsoft outlook: 1. I was wondering if it is possible to create an email from Excel which automatically adds the From-field with a pre-defined emailadres. I am using CreateObject("Outlook.Application"), but I can not add the From-field. 2. I also would like to know if it is possible to do automatically fill the To-field with the emailadress from the user who send me the original file. Maybe this needs some more explanation (sorry my english isnt too good): * A user can download an excel-form from the internet * The form is sent to my emailadress * I give a number to the form * The user will get a message that his question is attend to with the number of the question So I use a macro-button to reply when I have filled in the question-number.
View Replies!
View Related
VBA To Create A Hyperlink Drilldown For Each Cell
I need help in making a VBA to create a looping hyperlink drilldown for each cell in the inventory_general wksht. The purpose of this sheet is to allow a user to click on a hyperlink which will then reference a macro to autofilter the data in the bin_lot worksheet to display all rows for that particular item number. Apparently, you can't select all the cells and insert a hyperlink because all the hyperlinks will reference the first cell value for autofiltering. This is what I tried but it's not working obviously. Sub HyperlinkDrilldown() ' ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _ "Bin_Lot!A1", TextToDisplay:=target.value Range("A2:A21").Select End Sub
View Replies!
View Related
Creating Folders From Spreadsheet?
I need some help, I know very little about macros but is it possible to create folders/directories to a certain path using the text in an excel spreadsheet cell? For example, if cell a2 has a street address and cell b2 has a city, can it automatically create a directory in the path of my choice using that data? If yes, can it go down the the rows and create directories until it is done? Please help as I have hundreds of directories to create.
View Replies!
View Related
Open Workbooks In Two Folders
I have a script below that opens all the workbooks in a folder based on a msgbox. The script works as is. However what I would like to do is remove the msgbox and have the script go back and forth between the folders. Example it would open one workbook in the (Large Area)folder call my other script (Hazleton_Data_Conversion) Return Open a workbook in (Varsity) Folder Call the my (Hazleton_Data_Conversion)and repeat the process till all the workbooks in both folders have been processed. Like I said this script works with the msgbox I just like to change to without msgbox and to flip back and forth.
View Replies!
View Related
Finding Files In Folders
I need to design code that can check to make sure a specific file is found before it executes. Our files are all going to start with the same words followed by the date ex. Name 10-2-1998 I want the code to be dynamic and be able to check in the folder that the current excel sheet is in for the file i need and then have it ready for use in my macro.
View Replies!
View Related
List Folders With Certain Names
way of returning a list of folders that contain a user defined search string in their name. Eg., return all the folders within a directory/directories that have "x365" in the name. I am searching through a list of over 6000 folders that are sitting in four different directories. The following is the code i've come up with so far that creates an array called aFoundList containing all the folders that match my search string. Sub TryOpenFolder_LoopingMethod() Dim FSO As Scripting.FileSystemObject Dim oFolder As Scripting.Folder Dim vSubDir As Variant Dim vSearchDir As Variant
View Replies!
View Related
List Files And Folders
I have a folder that has a bunch of other folders in it, each containing many files. Is there an easy way to get a file directory into excel, so that I now would have a spreadsheet that tells me what all the folders are and what files are in each one? short example: main folder = mystuff subfolder1 = my pix, contains pic1 and pic2 subfolder2 = otherstuff, contains otherstuff1 and otherstuff2 Can excel find these things and give me a list indicating that the 'mystuff' folder contains these two folders, and also list the two files under each folder?
View Replies!
View Related
VBA - Create Folder With Date In Name, Populate With Sheets
I have a workbook that will have many modules (5) that will perform all sort of checks etc. The output for each module is a worksheet that i need to export to a new workbook named with the name of the original sheet and current date appended e.g. "Dbase 27 06 2008.xls". Every time any of the 5 modules is run a check is performed whether a folder with a specific name and date exists e.g. "Audit Tool 27 06 2008" and if it does not exist yet to create it. The new workbook should be saved to this folder with above mentioned name e.g. "Dbase 27 06 2008". I found some info on this topic but I just cannot assemble all pieces of code together (I am new to this).
View Replies!
View Related
VBA Macro Code To Create Multiple Charts
I need to create 63 charts from data which I have in two columns. I want to create multiple charts using one macro. For the first chart I want it to use cells K2:K80 as the x values, and M2:M80 as the y values. For the next chart I want it to use cells K81:K159 as the x values and M81:159 as the y values. For the next chart I want it to use cells K160:K238 as the x values and M160:M238 as the y values. I want to continue this, creating a chart for every 78 cells of data, all the way until the 63rd chart which uses K4900:K4978 as the x values and M4900:M4978 as the y values. I have created the following macro by " recording." This macro generates the first chart that I want: Sub Macro5() ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlXYScatterSmoothNoMarkers ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(1).XValues = "=Sheet1!$K$2:$K$80" ActiveChart.SeriesCollection(1).Values = "=Sheet1!$M$2:$M$80" ActiveChart.ChartType = xlXYScatterSmoothNoMarkers ActiveWindow.SmallScroll Down:=-3 End Sub How can I alter this macro to create all 63 charts?. It seems like there is an easy way to do this, but I don't use macros very much (at all).
View Replies!
View Related
Create A Named Range In VBA For Column A, Which Is A Sum Of B And C
I would like to create a named range in VBA for column A, which is a sum of B and C. The problem is that A can have 0 as a value. What I would really like to do is define the named range in column A as A2 to the last column with a value in column B(B10) which would make the named range in column a A2:A10. ABC 61555560 00 1250120050 725725 00 850850 1919 7216720016 995995....
View Replies!
View Related
VBA To Create Charts/Graphs From Non Continuous Ranges
I have an excel sheet populated with loads of values. There is a space between each set of data. I need to draw a graph for each section and i cant work out how to do it. I have attached the sheet in question. The gap between each column has "space" written on row, which is needed to prevent it being deleted. The drawing of the graphs needs to be automated as there is going to be 100's of sheets containg lots of data. The column size of each section can change so it needs to be dynamic. I have attached an example sheet
View Replies!
View Related
Processing Data In Multiple Folders
I have a VB codes to process the data from a file that located in the folder from directory. This VB will copy the data from the file and paste it into new workbook by clicking the command button. I want to modify this code in order to make VB can process the data from multiple file from multiple folders. Previously, I just write the code for one folder only. So now, I want to modifiy the codes in order to expand more folders. All the results will be pasted into the same workbook. Private Sub cmdStart_Click() Application. ScreenUpdating = False Set outbk = Workbooks.Add Workbooks.Open "C:" & TextBox1.Value & "" & TextBox2.Value Sheets("bin_trip").Select With ActiveSheet
View Replies!
View Related
|