I have previously tried to save the whole original workbook with the following ActiveWorkbook.SaveAs Filename:="C:UsersPhilDocumentsMy Excel DocumentsRostersIndividual Rosters" & StaffLastName & " " & StaffFirstName & " - Roster commencing " & Format(DateSerial(Range("X11").Value, Range("V11").Value, Range("T11").Value), "dd mmm yyyy") & ".xlsm
but receive a run-time error message:
Run-time error '1004': Microsoft Office Excel cannot access the file
My first request for help is how is the code wrong and how can it be corrected?
Secondly, instead of saving the whole workbook, is it possible to save just a given range of cells as a new workbook, using the format above to give it a personalised filename?
Suddenly when I open a ExcelWorkbook Microsoft Visual Basic shows a messagebox stating: "Runtime faillure 9 Subscript out of reach" only the closebtn is enabled. After closing the box the workbook opens normally.
I have 12 workbooks with 2 spreadsheets in each: Assessments and Instructions. What I would like to do is have one master spreadsheet of instructions I can use to update all the other sheets. After changes are made, I would like to run a macro that would copy the master instructions sheet, open the other workbooks, copy over the information in those workbooks (on the Instructions sheet only), and then close them. I have no idea where to start.
I have a number of Vlookups in sheet1 book A (originally created by someone else). When I use Move or Copy to copy sheet1 to workbook B all the vlookups show as =#N/A. Guess this is a setting somewhere?
I am moving some sheets into a new workbook and from the new workbook I want to prompt the user to save the workbook where they see fit. For some reason I cannot seem to save the new workbook only the old with the below code.
Sub Moving Dim wb As Workbook Set wb = ThisWorkbook Sheets( Array("Hk", "Li", _ "SAM")).Select Sheets("SAM").Activate Sheets(Array("Hk", "Li", _ "SAM")).Copy If wb.Saved = False Then Select Case MsgBox("Do you want to save your changes?", vbYesNo Or vbExclamation Or vbDefaultButton1, "J & R Solutions") Case vbYes wb.Close True Case vbNo wb.Close False End Select End If
i have a workbook blank template for my colleagues to fill in, they fill in this blank template and save it under the serial number of the item they are creating. However a lot of errors exist when they input the serial number inside the workbook where the serial number is a duplicate of a former serial number.
Anyhow i was wondering is there any way when they input the serial number into the worksheet that i could get it to save in a separate workbook and then have conditional formatting to check those serial numbers in the workbook to see if they match?
Creating a macro to compare 2 sheets in a workbook and print the differences to a 3rd sheet.
Each sheet will have the same number of fields, 5 columns with the header in the first row.
All values in the cells are integer except for the last field which will be a character.
The key is the value in the 2nd column. If it's not in the other sheet, then it's a new record. If it's a new record then highlight it a color depending on what sheet contains the new record. Now if the key is the same in both sheets, then check the other columns to see what's different. If there is a difference, print the record for both sheets in the third sheet and highlight the differences. I attached a sample of what I want.
All i did was i just created a form to open a workbook from the directories.
Code to copy the data from that recently opened workbook to my workbook where I have my forms. I need to copy that data as in the case that i don't know the workbook and the sheet name i'am going to open as i may open any of the files!!
I have created userform and it works fine. Following code assigned to 'SUBMIT' button in userform - works fine. I am trying to include code where certain data from userform is also copied to workbook2 ( of course without opening it)- as marked in red...below
I am trying to copy the emf image object from "Book1" into the "test" workbook whilst the test workbook is open and Book1 is closed. The code I have put together currently sort of works, I mean that it copies the text data over but does not copy the object which is what I require.
So I basically have a template workbook that the code is stored in. I need it to pull an entire row if Column C in workbook "rawdata" contains specific text, in this case "PRCH - Purchase".I have never had to do anything like this before, it has always been working in the same workbook. It's failing at the 'mp = ...' line every time. There might be other errors in the code too, I just cannot resolve the first one!
I will shortly be running a project over a twenty four hour period, where a group of people will be inputting data into a workbook (one worksheet per hour), and what I would like to know is if it is possible, to input some coding into a thisWorkbook module to action a save on the workbook every time an entry is placed in column A (of each worksheet) which is divisable by 10 (a10, a20, a30 etc).
I've written somewhat complex code (well complex by my standards) on my own computer and I have tried to put the project onto another computer so that they can use it. The code involves opening a workbook and then saving it under the variable name strName1. Then it activates another workbook and puts information into that workbook from the strName1 workbook. The strName1 workbook is open this whole time. However, I get an out of range error when trying to do this part (the code is shown below).
I am confused because this works alright on my computer, I have copied the root directories for the file exactly as it is on my computer and when debugging the code I can see that it has picked up the variable strName1 correctly (so this isn't the problem). I've also tried writing the entire root directory in insetad of just Workbooks(strName1) but it still says its out of range.
I have created a macro that copys pivot table from one Workbook to new workbook. Problems I am encountering are print selecting from source workbook are not copied to new workbook.
Dim AmountofColumns As Long, AmountofRows As Long Dim ColumnCount As Long, RowCount As Long Dim ThisWorkbookName As String, ActiveWorkbookName As String, ActiveSheetName As String Public Sub CreateGroups() Application. ScreenUpdating = False Sheets("Preferences").Select ThisWorkbookName = ActiveWorkbook. Name AmountofColumns = Range("A1").End(xlToRight).Column
For ColumnCount = 2 To AmountofColumns......................
I am looking for a code that would copy the data from each worksheet in a given workbook and then paste to just one worksheet within a different workbook. The Sheet names are auto generated when I run this canned report but the naming structure is always the same...the first worksheet is named Repair Details and then the next sheet is named Repair Details_1, the next sheet is named Repair Details_2 and so on for every sheet in workbook. So I would like to copy all of the data(Headers to last cell) and then paste in a worksheet(ex: Master Repair Report.xlsx and the worksheet could be titled Master Repair Details) on a different workbook, then the next sheet would copy from the one under the header to the last record and paste to the same workbook. This process would repeat for every worksheet in the Repair Details Workbook and paste to Master Repair Details worksheet in the Master Repair Report workbook.
I would like to run a macro from a worksheet that creates a new workbook for each worksheet (there will be 20 plus) and saves it in a new folder i.e. all the same directory L/Utilisation/Team/name of the worksheet.
I have been tasked with creating a macro which creates a new workbook wherein each sheet contains the information for one site from the active sheet. The active sheet already has the values sorted by the site such that all information needing to be copied from the active sheet into the new workbook is together.
ATL ATL ATL ATL CEN CEN JCK JCK etc.
There are 8 different sites on the active sheet: ATL, CEN, DAL, HAR, JAS, JCK, VIS, NOV
The macro needs to find the range for all of the data of each site and copy/paste that data into a new workbook such that ATL would have its own sheet, CEN would have its own sheet, and so on. The data ranges from A:R.
So, for example, the macro would find that the last row with ATL in the "B" column is 6095 and would then copy A2:R6095 and insert that data into the new workbook under Sheet 1.
I had some code that I had adapted to select the range for each of them, but the code loops through the entire sheet (which is 44,307 rows long) for each site making it a quite clunky and very slow step in an even longer macro. Since the data is already sorted, I know there must be a way to have the macro stop searching when it reaches data not equal to the data the row before, however, my experience with VBA is limited, and I have been unable to find a solution. Also, the data does not have to be conserved after being sent to the new workbook, if that would speed up the macro.