file name

  1. S

    Define As String variably using If & ElseIf

    Hi there experts! I have a preexisting VBA code to create and submit data files into a Snowflake Data Warehouse. Now, they'd like me to change the data file names to have a version suffix, to differentiate files in case we need to resubmit them during the month. For example "..._01", "..._02"...
  2. M

    Need to make multiple copies of shift report with different dates in the name of the xlsx file.

    I am a lead maintenance mechanic and trying to figure out how to create dated shift reports. Our naming system is (Master file is named "Shift Report.xlsx") Shift Report 7-16-2021 D1 Shift Report 7-16-2021 N1 Shift Report 7-17-2021 D1 Shift Report 7-17-2021 N1 etc... I have to generate these...
  3. A

    Copy File Name Into Sheet

    Hi I have part of my macro pasted below. The problem I'm having is I'm getting the full path name of the file, which is not what I want. How can i get ONLY the file name itself pasted into cell A1? Set Wbk1 = ActiveWorkbook Fname = Application.GetOpenFilename Set Wbk2 =...
  4. VBE313

    File Name and Path refer to cells

    Is there a way to change the path name depending on what the user types in? I know you can do that with the file name.
  5. C

    Create Macro to Save Active Sheet as PDF and save with in a Specific File Path

    Hi I am trying to create a macro that picks up the file path that is entered on my Spreadsheet and save it as a PDF with in this File Path along with a specific file name: The File Path is below - I need it to go to R1\R2\R3 (S:\Finance\F19\03 SEP 2018) <tbody> Q R 1 File Path S:\Finance...
  6. H

    File names to excel from respective folders

    Hi All, I am working on some automation and need your help in vba code to get excel file names from respective folders......for example ..I have 10 different folders and need the file names those were inside the folder to excel cell starting from A1, A2, A3...so on... if I get the complete...
  7. A

    Run macro w/ relative reference for File name (changes monthly)

    Each month I update/change the file name and have had do manually go in and edit all macros. Is there a way to avoid this? Also, from what I've seen online, many recommend using "ActiveWookbook" or something similar....this will not work for me as I have macros pulling from multiple workbooks at...
  8. I

    SaveAs ilename in Current Directory

    I'm having trouble with the following code. It works perfectly, except that it adds the name of the parent folder at the beginning of the SaveAs filename. The SaveAs file name should be "ParsedInfoData.xlsx", but it is saving as "ParsersParsedInfoData.xlsx". The name of the folder these files...
  9. B

    Combining Files with File Name

    Hi, I have built a VBA macro to combine multiple Excel files into one sheet, format the contents and then do some calculations. However, it would be really useful to have the original file name against each row in the combined sheet. For example, I could see that rows 1-20 came from Sheet A...
  10. E

    Set Const as a dynamic/variable date

    Hello, I have the following code that works well. It searched for a file saved with the most recent date in the file name and opens it. Sub Test() '---Opens a sheet based on date, searches backward from today til it finds a matching date Dim dtTestDate As Date Dim sStartWB As String...
  11. W

    Need a macro to work on any filename

    I have several macros in my Personal Wrkbook. They all do different tasks but look for the file named aging.xls I run different reports and didnt want to give each one a different file name, which is why I name any file I export from our accounting system 'aging' Although this technique works...
  12. S

    only numbers from the file name.

    My filename is like this e.g. abc-253-sffdd.xlsm. I want only the number from the filename as my return value. in the above example I would like my return value to be 253. In below example. drvd951sdfdfd.xlsm is my file name. the return value should be 951. Whatever number is there in the...
  13. weiser386

    Saving an exported chart as the current date file name

    I'm trying to export a screenshot with my macro and I'd like it to save as a date and time format...I think I'm some what close but I need help. Thank you in advance Sub CopyRangeToGIF() ' save a range from Excel as a picture Dim rng As Excel.Range Dim cht As Excel.ChartObject Dim FName As...
  14. M

    Copy and Paste from Excel to Notepad, then Save with Specific Filename

    Hi! I'm working on a program in VBA that requires copying and pasting from Excel to Notepad, and I could use a little help. In another method in the same worksheet, a program automatically generates the contents of a sheet, x amount of cells at a time (it's not fixed, it's based on user...
  15. A

    Paste file name and extension using file explorer

    See code below.... Sub GetFilePath()Set myFile = Application.FileDialog(msoFileDialogOpen) With myFile .Title = "Choose File" .AllowMultiSelect = True If .Show <> -1 Then Exit Sub End If For I = 1 To .SelectedItems.Count Range("K" &...
  16. S

    Macro to save file with its current name but in a different, specified location

    Hey guys - struggling here. I have a macro and I want to end it with saving the file in a specified location - not the current location where I am opening the file from. When I use this macro again, it will always need to be saved at that specified location. However, I want to save it as the...
  17. M

    importing file name to cell

    Hi all, Hopefully this will be an easy one for you guys although I can't find a solution anywhere. I have a simple macro which imports various data from RAW excel files and cleans it into a separate excel sheet. Sub importpart2() Application.ScreenUpdating = False '' SETUP...
  18. 9tanstaafl9

    Find name of external open workbook using VBA

    I need to copy data from an open workbook for which I do not know the name, into my workbook that contains the macro that finds this information. I need to know how to get the name of the workbook with the data. Is this possible? I've searched the Internet for two days now and can't find it...
  19. D

    Finding files that DON'T end in (1)

    Hi, My instrument spits out two text files of raw data. The analysis I need to perform is depended on which of the two files I'm looking at. The text files have the same filename however the 2nd file has (1) at the end. I can loop through half the files using sFile = Dir(sPath &...
  20. O

    VBA - Importing CSV - Start column B; File name column A

    I found a VBA code online to import data from CSV files and paste into the active Excel sheet. I already edited a few parts but can't get the last bit right. What it currently does: - Imports data (2nd row down) from all CSV files in same folder as main file (.xlsx) is stored - Pastes data in...
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

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
Top