Running Macro Based On Sheet Name (Multiple Sheets)
Dec 20, 2012
I have multiple sheets in one file. I need a code (that will be ran at random) to look at all the sheet names and the ones that end in the word "Archive" to move to another file.
View 5 Replies
ADVERTISEMENT
Jun 30, 2006
I would like to run the code below on selected sheets in my workbook:
Range("B9:AW38, AZ9:BE38, b3").ClearContents
I tried using this but it doesn't work:
Sub clear()
Sheets( Array("sheet A", "sheet B", "sheet C")).Select
Range("B9:AW38, AZ9:BE38, b3").ClearContents
End Sub
View 2 Replies
View Related
Oct 22, 2013
I need to run a very simple macro (filter by date, copy, and paste) on every worksheet in a workbook, and then place that data into a summary page at the "end" of the workbook. Most other posts had to do with some kind of formatting that would work in succession on the sheets linearly from left to right (for lack of a better way to put it). My problem, however, is that the data would need to be pasted into the summary worksheet, and then somehow the macro would come back to the next sheet (after the one it just did) and do it all over again, so on and so forth. The worksheets are arranged alphabetically, but other than that there is no sort of easily identifiable progression between them (i.e. Sheet1, Sheet 2, etc.).
View 9 Replies
View Related
Aug 16, 2013
I have an excel document with multiple excel sheets(sheet1, sheet2...etc), now every sheet contains a cell "total".
Now I want to copy the row containing "total" from all the sheets into another sheet called "report".
View 9 Replies
View Related
Feb 19, 2012
I've got data being scraped from a site, putting 1 new workbook in a folder each day
each workbook has 40 sheets in it.
i need to run 5 modules in sequence on a sheet then loop to the next sheet and run the same 5 modules.
ive writen all the modules, and can loop them through the sheets in sequence but i cant work out how to loop them through the each workbook in the folder..
is there an easy way to do this or can it not be done because it would need access to the folder that holds all the wordbooks which lives outside of excel on the desktop ?
View 5 Replies
View Related
Oct 23, 2013
I am having trouble getting the selection of sheets to work. I have a workbook that has multiple sheets and one constant sheet (Summary). There is code to create new forms in this workbook and insert them after the Summary sheet. These forms all have a date input that is formatted as a date (mm/dd/yyyy), these dates get modified on the day the form is created, there may be any number of sheets created during this process. I have to print the summary sheet and only the newest forms created. I need a code to select sheets to print based on the date input of a user for each form. This is what I have so far:
VB:
Dim i As Variant
i = Range("B5").Value >= InputBox("What date to start PDF from? Format = mm/dd/yyyy")
Sheets(Array("i")).Select [code]....
If the dim can be taken out and just included in the line for the array that would be fine with me. The cell "B5" is where the date is located in each form. I want to input a date and the macro will select the sheets where the date is equal to and greater than the date entered. The Summary sheet will always be included in the print set. I have a dialog box for setting which printer to use - this file will be used at different offices and therefor the printers will be different and it will also allow to create a PDF if desired.
View 9 Replies
View Related
Mar 27, 2014
I am trying to find a way to copy the contents of an entire row to a new sheet in a workbook based on the value of a column, specifically column K with the value of "good". There are 3 sheets that im searching. This is where I run into problems. Im looking to start with sheet1, and copy all rows deemed "good" into entries on sheet 4. Then search sheet2 and copy all relevant entries into the next available row on sheet4, and then repeat on sheet3.
View 2 Replies
View Related
May 26, 2014
Currently I have it setup to copy rows to a sheet "Report" based on a single cell value. But now I need the same thing but have it copy the rows based on 2 cells values to sheet "Report". So for example I wanted to copy and paste each row in my workbook that contain values in Columns N:N that contain the value "Test" and in columns AB:AB that contain "1".
Sub copyagain()
Application.ScreenUpdating = False
Dim sh As Worksheet, findThis As String, fAdr As String, fLoc As Range
findThis = "1"
[Code]....
View 9 Replies
View Related
Jan 12, 2008
I have some code which I want to run on all apart from one sheet called 'List'. At the moment I am selecting each sheet before running code for the specified sheet. This doesn't allow for any sheet name changes etc. or additional sheets. Is there a quicker way of doing this rather than having a sub to manually select each sheet?
Here is an example of my code for a button on the sheet called 'List'. The only thing Sheet1, Sheet2 does in this code is select that sheet.
View 14 Replies
View Related
Feb 11, 2010
This Macro works fine to copy data from multiple sheets into one master sheet, but it is also copying the formula. How can I change this Macro so that it is copying and pasting VALUE only?
Sub Combine()
Dim J As Integer
On Error Resume Next
' work through sheets
For J = 4 To Sheets.Count ' from sheet 3 to last sheet
Sheets(J).Activate ' make the sheet active
Range("A10").Select
Selection.CurrentRegion.Select ' select all cells in this sheets
' select all lines except title
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
' copy cells selected in the new sheet on last line
Selection.Copy Destination:=Sheets("Combined").Range("A65536").End(xlUp)(2)
Next
End Sub
View 4 Replies
View Related
Jan 29, 2014
I would like to have a macro that will hide a column based on the value in the row. I have multiple sheets and if row 4 (or more specific, B4:AL4) contains a zero, then I'd like the whole column to be hidden on that sheet. I'd like to be able to run the macro and it evaluate every worksheet.
View 5 Replies
View Related
Sep 13, 2012
I need a Macro which pulls the data from different sheets of excel (which is not formatted properly) to Main Sheet. Also some of the columns will not have the same names, so macro should handle this exception as well.
View 8 Replies
View Related
Feb 16, 2012
We have a company and need to automating workflow.
The Master sheet contains incoming mail details by customer. Each employee is assigned a set number of customers to respond to. We want the information on the Master sheet to filter to a specific employee assigned sheet. On the employee assigned sheet, once filtered, they are to provide updates in column E
Date
Reference no.
Name
Employee ID
16-Feb-12
S/S/1
[Code] ........
We need a macro that can filter customers' details to the specific employee assigned sheet based on the employee ID in the master sheet. For example, all customers assigned to DW (i.e with the 'DW' employee ID) filters into a sheet called 'DW'. Please note that the Master sheet is a continuous log updated daily. This macro must not duplicate information previously filtered once the employee enters a status update in column E.
View 2 Replies
View Related
Oct 27, 2008
Some of my sheets are flickering even when there is no macro running. It blinks and flashes from time to time. It does not affect the funktion in the sheet except that its annoying as hell. Some times I have to scroll down and back up to "clear" the screen from the flicker/flash effects.
I can open an old file fresh and it flickers and flashes from start. It doesnt matter if I start it with or with out macro activated.
View 9 Replies
View Related
Apr 7, 2014
I have approximately 30 workbooks for which i open and run a macro to change the look and feel for client perusal.
I normally open each of the 30 workbooks and run the macro for each one.
Is there a way I can run the macro to apply to all workbooks at once?
View 3 Replies
View Related
Dec 20, 2013
I am seeking code that will go to Sheet 4 (named "Extract"), copy a1:a5 and return to the active cell the macro was launched from and copy the values in.
The challenge I am having is how to get the code to return back to the cell it was launched from since I want the flexibility to use this macro in multiple tabs/sheets to copy the info into ANY selected cell within ANY sheet. As it is now, I have to go change the sheet name each time for the then active sheet.
I've attempted to insert a generic worksheet reference, however I end up with a debug issue.
Sub Macro10()
'
' Macro10 Macro
[Code].....
View 2 Replies
View Related
Dec 26, 2009
I have a workbook with 26 sheets, labelled A to Z. Column A in all the sheets have names from rows A6:A35.
I need a macro or a code to extract all the names from each of the 26 sheets and paste it to a new sheet 'Names' under column A, such that names starting with 'B' paste under all the names 'A' and so forth till 'Z'.
View 9 Replies
View Related
Mar 30, 2014
[Code] ....
But it doesn't show the correct sheet after running it.
I need it to show the sheet called "Invoice with code".
View 3 Replies
View Related
Jan 27, 2008
I am trying to write a macro that will run another macro (already written) through all the sheets/tabs in a workbook one sheet at a time and will stop once it reaches the last sheet/ tab.
Can you assist me in writing this macro.
View 9 Replies
View Related
Sep 9, 2008
I am getting an error when I protect a worksheet and save it. Upon re-opening the worksheet, I try to use the cells that are being formatted by a macro, but I get the following error...
Run-time error '1004':
Unable to set the NumberFormat property of the Range Class.
If I open the worksheet and it is already protected from when I last closed it, then I get the error. If I unprotect the sheet, then close it and reopen it, then I don't get the error. Does anyone know what I might be missing or doing wrong.
View 9 Replies
View Related
Oct 2, 2013
how to run my Macro over multiple (about 60) .xlsx files. I have been looking around, but haven't quite got anything working yet.
I have all the files in the same folder with similar names (i.e. Subject_01.xlsx, Subject_02.xlsx, etc.).
What I'd like is:
*open Subject_01
*run script (some calculations, copy/pasting, my script for this is working fine)
*save file under a different name (i.e. Subject_01_processed.xlsx)
*close file
*again for Subject_02, Subject_03, etc.
Additionally, I have a second question: after I have the processed .xlsx files, I'd like to copy some cells from each .xlsx file (e.g. A1-H1) to a new file. There, I'd like the data from Subject_01 to for example be in cells A1-H1, from Subject_02 in cells A2-H2, etc.
View 5 Replies
View Related
Oct 5, 2007
I have 3 seperate macros (macro1, macro2, macro3) that have to be run in order. Is it possible to create a macro to run them in order and what would the code look like? I will have it assigned to a button on the worksheet.
View 9 Replies
View Related
Apr 7, 2009
I would like my macro to go to a certain folder- in this case N:Aexeo ClientsJabre2008Excel Diet Run, open each workbook therein ( to this end I have found the first part of the code below on another thread) and perform the ExcelDietMacro (also below). I am missing something though as nothing is happening, would anyone know from a quick glance what is wrong? Should I have these as 2 seperate Sub End Subs or combined into one? I know that the Excel Diet is correct thanks to the original designer and Rory on the forum for getting it adjusted to my needs.
Also each workbook within the folder will have the same password to open, is it possible to insert some code in the macro to do this automatically?
Sub LoopFiles()
Dim MyFileName, MyPath As String
Dim MyBook As Workbook
MyPath = "N:Aexeo ClientsJabre2008Excel Diet Run"
MyFileName = Dir(MyPath & "*.xls")
Do Until MyFileName = ""
Workbooks.Open MyPath & MyFileName
Set MyBook = ActiveWorkbook
Application.Run "ExcelDietMacro"
MyBook.Save
MyBook.Close
MyFileName = Dir
Loop
End Sub
Sub ExcelDietMacro()
'
' ExcelDietMacro Macro.........................
View 9 Replies
View Related
Aug 31, 2006
I am trying to find a way to set up a macro that will allow me to pull in data - create the Pivot table - delete the table - then pull in fresh data (of a different row length - same number of columns) and create another Pivot table. I have tried to manipulate recorded code to no avail. Here is what I am starting with:
Const lngLastPossRow As Long = 65536
Range(Cells(1, 1), Cells(Cells(lngLastPossRow, 1).End(xlUp).Row, 24)).Name = "Data"
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:="Data"). _
CreatePivotTable TableDestination:="", TableName:="PivotTable2", _
DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable2").AddFields RowFields:=Array(" ", _
"Channel", "Sales/Exchange", "Mode of transp.", "Sold-to Party", "Material", "Data")
While it creates the first pivot table fine, after deleting it and starting again it wants to create the next sequence (PivotTable3) which crashes the macro. I must close the file and reopen to run it again.
View 4 Replies
View Related
Apr 28, 2009
i have a spread sheet which has a very complex simulaton in it. excel is not the ideal place for it, but it is not possible to port it wholesale to something more sensible. i have modified the code so that it is possible to run two copies of the spread sheet (in two seperate excel processes) at one time. Due to the dual core nature of the machine this has almost no overhead.
I have created a controlling spread sheet that is cabable of launching multiple copies of the simulation and starting the code executing. the problem is the controlling spread sheet always waits for the code to return before it continues, hence it would open two seperate versions of excel, start the first simulation executing and then wait until it completes before starting the next one. is there any way of starting a function in another work book without waiting for the execution to complete?
View 2 Replies
View Related
Feb 17, 2010
I want to be able to run a certain chunk of code in the macro if a certain condition is true, or if that condition is not true then I want to bypass that chunk of code. It doesn't matter if this is accomplished with an if... then... else statement, or some other way.
View 6 Replies
View Related
Feb 21, 2009
I want to be able to select a cell, for example A10, this would then run a macro that would copy and paste several cells of information along that row and paste it on another worksheet. However, if i then choose a15, a3, a79 in turn (using the control key), it would run the macro using those rows in turn.
i'm looking forward to hearing if and particuliar how this could be achieved.
View 13 Replies
View Related
Mar 16, 2008
I have about 20 workbooks with different file names for different projects all saved in the same folder. Each workbook has about 10 worksheets and each worksheet is named in a similar fashion in each of the 20 workbooks (eg. revenue, cost, variance etc.). I want to pull out a worksheet named ' forecast' from each workbook into a master workbook so that the master workbook would contain the 20 forecast worksheets.
View 9 Replies
View Related
May 6, 2014
I would like a macro to be able to save 26 tabs within the one document to individual PDFs.Preferably I would like to be able to specify each time exactly which tabs get printed, because often I don't need to print all 26, just the first 10 or so.I would like each PDF to automatically be named with the value in cell E10 of each tab.E10 already has a formula to create its final value. It references cells from other tabs within the same document. Hopefully the fact that this cell has a formula in it won't affect my ability to use the resulting value as a 'save as' reference?I would like it if the PDFs save to the same location as the Excel sheet from which they're generated is located. The location of the excel sheet will change every three months, so I'd prefer not to specify a location with a specific filepath, as it will have changed by the time I run the macro again.
I am using Excel 2010.
View 5 Replies
View Related
Aug 26, 2012
I have master sheet which is not fixed row (rows are variable)
In Column A has customers name (customer names are repeating more than once).
Table range("A1:D30")
I want to create a sheet with customer name and related data should be copied from master sheet.
This can be done by advance filtering and coping but I failed to create sheets automatically.
View 4 Replies
View Related