fname

  1. G

    VBA to create new worksheet and using values from original workbook for SaveCopyAs name and path

    I have the following VBA which works to take data from the Workbook, create a new workbook and paste that data. Now I want code to utilize the SaveCopyAs to automatically save the file with name (fname) and path (fpath) taken from the original Workbook. I just don't know how to do this. The...
  2. N

    "Help needed!" in VBA Code for find the issue

    I have search much old thread but not getting the solution, I am able to find the error in my coding , Its look fine but in test run is not working,according to my step. below coding is some part of coding:- 1-I have files folder and there are many sub folders ( Name and number of count sub...
  3. N

    For Each MyCell In MyRange is not working in second time

    Hi Friends, I need help in vba. I have create the complied the excel files form the folder in one tab,I have done the coding the get the sub folder name list in one column , I want the coding create the tab name according the list , my coding is working fine when its run first time but after...
  4. W

    Change page orientation of all visible sheets

    Hi All, I have tried many things to get this to work, but so far, I have drawn a blank!! I need to be able to print to PDF in landscape. Here is the code to print multiple (visible) sheets to a single PDF (it works perfectly). There are about 20 visible sheets remaining. Sub PrintPDF() Dim...
  5. A

    Display Graph in Userform

    I have this code that generates a graph. I would like to display the graph in a userform. I'm getting an error and I'm not sure why. Please help. Thanks Sub MyCandlestick()Dim OHLCChart As ChartObject Dim LRow As Long Dim ChartName As String, fname As String LRow = Range("AA" &...
  6. C

    Little Nudge needed to get me home free

    Hi everyone, I am trying to get a Word document to open (so that it updates its date) and then save it to a designated folder as a pdf. I tried to adapt a great macro I got in this forum but to no avail. Here is the code, thus far: <code/>Sub SubTest() Dim Pth As String, Fname As String...
  7. I

    Ignoring blank cells

    Hi, I’m using this macro and it works great, but it is giving me an error message if the ranges in m8:m47 on the status sheets 1/2 & 3 are blank? Can anyone help me out to ignore blank cells in those 3 ranges? Thanks Sub NewButton_Click() Dim fname As String Application.ScreenUpdating...
  8. BrianM

    VBA First Name

    Hello all, Using VBA, what is a simple line of code to obtain the first name from A1 (John Doe) so that I can set it as a variable? My brain says Dim FName as string FName =LEFT(A2,SEARCH(“ ”,A2)-1) but I know that won't work. I don't want to use a formula in a helper cell to only then set the...
  9. S

    Error Handling for the mkdir command

    Hi, I have written some code which saves down a particular sheet of my excel workbook in excel and PDF form. I use the mkdir to create a new directory for the files to be saved in - however I need to insert some error handling into my code so that if I have already run the code and created the...
  10. M

    Passing File Name when creating ChartSeriesCollection

    When I create the Chart on a worksheet, the Excel file name is being used in creating the Chart SeriesCollection. I am struggling with figuring out how to pass the Excel file name as a variable when creating the chart. I want the user to be able to call the Excel file whatever they want vs what...
  11. A

    Subscript out of range error copying worksheet to new workbook

    I need some help ... Fpath = "U:\PWS\Parks\Parks Operations\Sports\WATSOP19\STAFF\BackupData\" fname = "staff_schedule_BU (" & Format(Now, "dd-mm-yy hh,mm,ss") & ").xlsm" Set newbook = Workbooks.Add wb_pstaff.Worksheets("STAFF_SCHEDULE").Copy after:=newbook.Worksheets("Sheet1") If Dir(Fpath &...
  12. O

    Automatic saving to multiple destination.

    Is it possible to save your workbook to 2 destinations? When I try to put 2 destination on VB it doesn't work. Sub SaveAs() Dim FName As String Dim FPath As String Dim NewBook As Workbook Application.ScreenUpdating = False FPath =...
  13. rhino4eva

    Making an array a variable

    Sub import() 'Application.Wait (Now + #12:00:05 AM#) Dim fName, DrivePath 'Uses open file dialog box Sheets("Sheet1").Select DrivePath = "T:" With Application.FileDialog(msoFileDialogFilePicker) .InitialFileName = DrivePath &...
  14. S

    Making Connections.Add2 Dynamic Trouble

    Hi, Thanks for reading. I am trying to connect a table using connections.add2 after a running a macro to create a table for a user to input data on to. On another hidden and locked tab i am attempting to then link it to the first table created. My code is naming the table that is originally...
  15. S

    Same code works differently in a different folder ? (no fixed pathing in code)

    So my code works differently in a the same file, but in a different file path Sub SaveAsExample() Dim FName As String Dim FPath As String On Error GoTo Handler: FPath = Sheets("Setup").Range("A1").Text FName = Sheets("Setup").Range("G1").Text...
  16. S

    How to Save as based on values in cells if the name already exists

    So surprisingly I didn't find such a simple addition to the save as macro that already exists. So I created it myself. There is already a macro that does saving as based on value in cell, but when this file already exists it pops up an error if you don't replace the file My objective was to...
  17. V

    Loop through slicer and save to PDF

    This has been asked here and other sites, but for the life of me I can't figure out how to get it to work. I have a workbook built in Powerpivot. First sheet is a bunch of slicers for province, city, area, region, division. I want to loop through the divisions and save the second and third...
  18. B

    Need help with this small macro

    Hi, I have the following code for saving a new sheet, but this only works when the original file is .xlsm. Any way to change this to work when the original file is .xltm? When the original file is .xlsm it saves in the right shared Onedrive folder, but when the original file is .xltm the now...
  19. C

    VBA code to create pdf file WITHOUT saving the document

    Hey, I currently have a code in place that converts my active sheet into a pdf file when clicking on a command button, and it automatically opens up in outlook ready to send. The problem is that when converting to pdf, it is also saving a copy of this new pdf document in My Documents on my...
  20. T

    Save Active Sheet Macro

    Good Morning, I have an excel workbook that has multiple tabs. Here is what I am trying to accomplish: 1. I would like a macro to save the current active sheet by its worksheet tab name: Some_Active_Sheet_Name2 or Some_Active_Sheet_Name3 or Some_Active_Sheet_Name4 2. I would like to...

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
Back
Top