chdir

  1. K

    Can you lookup a directory name stored in a sheet and use it to ChDir ?

    Hi I have saved a directory location in a cell in a worksheet. In my macro I want to retrieve the directory and change to that directory. I have used the following simple code: Sub TestingChDir() Dim sDirectory As String sDirectory = Worksheets("Assumptions").Range("J17")...
  2. G

    ChDir path problem

    I have been using a macro successfully for sometime now, but I have just bought a new machine and I am running W10 and 365 E3 and now the macro will not see the path of the file The files are all stored in the cloud (Office 365, OneDrive for Business) but are also synced with File Explorer When...
  3. G

    Need assistance in cleaning up a macro

    Hi I have the following macro and I need to tidy up and make a few changes if poss. What it is when it opens up X/BACKUP I need it to auto create a subfolder and then ask me to name it before moving the data from the other files into it. Macro enclosed. ActiveWorkbook.SaveAs...
  4. E

    Elseif macro to skip macro and execute another macro if conditions are not met

    I want to create a macro that will create new sheet and save the same if the value in particular cells are >0 I created one but its only saving one sheet at a time and not moving to second macro if the value in first cell is >0 Please assist Sub if_1()If Range("c2").Value > 0 Then...
  5. N

    Modify macro

    Hi, I have the macro below so that it saves a copy of an excel sheet to pdf in folder named "chits". I need that the file name will be as cell J8. What I have to change in the macro? Thanks in advance Sub Macro1()' ' Macro1 Macro ' ' ChDir "C:\Users\littl\Desktop\chits"...
  6. A

    VBA Save As PDF error

    hello guys i make excel sheet in link below and make macro for it to save as PDF put this error always stop me can you help me with that :mad: i used this code : Sub save_pdf() Sheets("Sheet1").Select Dim filename As String Dim ChDir As String filename =...
  7. H

    Convert date toregional setting on Laptop/PC

    When I import CSV files into Excel the date format changes from dd/mm/yyyy to mm/dd/yyyy I have tried to amend my macro for importing files toimport the dates format the same as my regional settings on my Laptop/PC It seems to do these for the majority of the dates but some dates , but not...
  8. K

    file path change

    Hi all, I am trying to display the below path in a dialog box after changing the current directory in An Excel Macro. Code Sample: ChDir "G:\Inventory Management\Daily Audits\BCS" externWorkbookFilepath2 = "G:\Inventory Management\Daily Audits\BCS" MsgBox externWorkbookFilepath2 MsgBox...
  9. R

    Macro Not working when I share with other co-workers

    I have a simple macro that saves a sheet in the workbook as a PDF. It works perfectly on my computer but when I share with co-workers it doesn't work. It appears as though the ChDir is pointing to a path specific to my computer. Is there a way for that to be dynamic to the computer it's...
  10. B

    macro to PDF printing

    can anyone tell me why I'm receiving an error on this macro and it's not printing/saving all the tabs to PDF in the current file folder? Sub ExportAllSheets2Pdf() Application.ScreenUpdating = False ChDir ThisWorkbook.Path Dim ws As Worksheet For Each ws In Sheets...
  11. C

    Need Help! Create New folder and save file in the new folder

    Hi All! New to VBA. Struggling with this. Would appreciate any help I want to, open a workbook save it in a new directory from created from cell h5 value F:\Job Packets"H5"\my new file name (which will be value from h5 as well followed by the word "lot" I have macro to save work book as the...
  12. S

    GetOpenFileName initial Path

    Good Evening All, I'm using the below code to select .xml files for import. I would like the import dialog box to remember the location of to last file as that is where the subsequent files for import are most likely to be and will therefore stop the user having to hunt through tiers of...
  13. H

    Exit Sub depending on no of sheets

    I have the following macro to open a source workbook and to copy from sheet1 to sheet 1 on the destination workbook The maximum number of sheets on the source workbook is 3 However if there is only 1 sheet on the source workbook , then only macro Open_FPSTAT4 must be activated, if here are...
  14. J

    VBA to allow directory from cell

    Sorry if title is confusing, i have this vba script which works fine It loads up a sheet from another workbook. Sub LoadSheet() Dim FileName As String Dim WS1 As Worksheet Dim WS2 As Worksheet Dim ActiveListWB As Workbook ChDrive "C:" ChDir "C:\users\jay\desktop" Set WS2 =...
  15. P

    Change drives and change directories

    Hi, I need to write code such that when the workbook is opened at any location (can be up to 14,000 stores) I can open a directory on a virtual drive R (which is localized to that location) to access folders located there and pull data. Currently, I inherited a file that says this, but I...
  16. B

    Save Code not working

    I have this code that is suppose to go to a directory and allow a user to define the file name and save in that directory. The only problem is, the code do not give an error of any kind and after you attempt to save and follow the path to where the file should be it is not there. I may have it...
  17. S

    VBA: Having ChDir filepath based on vlookup

    Hey guys- Any help appreciated. I have combo box user form, and depending on the user selection, a vlookup determines the appropriate filepath for my ChDir. How can I set ChDir equal to that cell value? Having difficulties. Thanks-

Some videos you may like

This Week's Hot Topics

Top