Macro To Delete All Worksheets Except For One Called Main
Mar 26, 2007
Does anyone out there have a macro that will delete all worksheets except for one specific one? In this case I want all worksheets deleted except for one called "MAIN".
I went through your board and found the code below posted My Mr. Tom Urtis. I tired it and it worked fine except that it needs another workbook. Can it be changed to work in the same workbook to copy to a sheet named as Main from all other worksheets that I can chose?
Sub ImportDistricts() 'Instructional Message Box MsgBox "Click OK to access the Open dialog." & vbCrLf & _ "Navigate to the folder path that contains" & vbCrLf & _ "the District workbooks you want to import." & vbCrLf & vbCrLf & _ "When you get inside that folder path," & vbCrLf & _ "use your mouse to select one workbook," & vbCrLf & _ "or use the Ctrl button with your mouse" & vbCrLf & _ "to select as many District workbooks" & vbCrLf & _ "as you want from that same folder path." & vbCrLf & vbCrLf & _ ....................
I am in need of an Excel Macro to help me create an address list by market. For simplicity sake I’ll set up a mini-example: I have an Excel document with a MASTER tab that lists the Market (Column A), a person’s name (Column B) and their Phone number (Column C). What I need to macro to do is read column A and make a new tab for each market in that column, then populate the name and phone fields accordingly.
A found one macro that was close, but it does not automatically make a new tab (I have to do that manually) and it does not refresh the sheet each time I open it, so when I run the macro again I get duplicate entries.
I want to be able to create a log of incoming orders and requests with a column containing initials of the person who will be responsible for handling the item entered. From this sheet, I want to populate other worksheets in the workbook with the data base on the initials placed in the first column. Each initial set would have its own dedicated sheet in the workbook.
Is it possible to create and IF "ST" in column A of main log THEN copy all data to designated fields on the ST worksheet?
spliting of main data By column criterias which start from column E1:L1 something like Pivot Table in new worksheet, but based on formula functions.Each worksheets have to based in one of this column D1:K1 headings. That also have to rapidly change with main data table.
I have to create a report that captures the work of 2 different resources on each day of the month, the sheet i am working with has 3 tabs - Main (this houses the main report, with identical fields for each resource), ABC - for details pertaining to work done by the resource ABC ... and a tab called XYZ for details of work performed by XYZ. A resource can work on multiple projects and 3 different modules in one day.
So for each date, i need to bring in the details for columns .. Project Name upto the column # of FB's, for each resource that is for ABC and XYZ.
I have attached a file with sample data, it has the main tab with what it looks like before the data is pulled from the ABC and XYZ tabs ... and what it should like after the required data has been pulled from the ABC and XYZ tabs.
What i am looking for is the formula that i got to enter in the main tab in order to pull the required data from the ABC and XYZ tabs for each date mentioned in each of the columns for each resource (that is ABC and XYZ) in the main tab.
I am building a workbook for small group of people in my office to use. I have 7 tabs, the first one is called Main Sheet and the other tabs are the names of each person using the excel workbook. Every tab looks the same, I have the columns labeled: date - job number - job name - contact # - comments
My desire is that each person will be able to input their data on their tab as they receive new jobs, and the main sheet will be a compilation of everyone's sheet. So to clarify, as new information is added to one tab this entire row of information will automatically be added to the next available spot on the main sheet. We are all on the same server so we can all work off the same file. Is this possible to accomplish?
How to Update the Worksheets field value based on updates done in Main Worksheet. As i have two different worksheets (Which can be even more then 5) and i want to update the Column Field value of "State" in work sheet "B" & "C" based on the updates done in "State" Column Field value in Worksheet A. I just want to update the "State" Column Field value in Worksheet "A" and it should update the "State" Column Field value in Worksheet "B" & "C". Only the criteria to match is Number. Based on number i want to search the values in Worksheet "B" & "C" and want that these values also get updated.
I've altered a Print Worksheets Macro from the web to allow me to choose which worksheets I want to delete by selecting a checkbox. For some reason, though, the macro almost always deletes the last worksheet as well as the one selected.
I've altered a Print Worksheets Macro from the web to allow me to choose which worksheets I want to delete by selecting a checkbox. For some reason, though, the macro almost always deletes the last worksheet as well as the one selected.
It would be great of I could delete all but one of the hidden worksheets. It would be perfect if I could tell the macro not to delete one of the hidden worksheets (called "Test O2 and CO2"), but if that is too difficult, then just one to delete all the hidden sheets would be fine.
I have a macro that delete empty cells in a column, what i wanted to do is while deleting the empty cells is that the macro will also delete duplicates in ENTIRE WORKSHEETS. My file has so many sheets so i need a macro that run or loop on my entire worksheets.
This is my code. that only runs in a single sheet.
Code:
Sub deleteblanks() Columns("H").SpecialCells(xlBlanks).Delete (xlUp) End Sub
I'm trying to track information pertaining to employees across different worksheets in one excel file. I have one sheet that is the master list of employees. The first column of every worksheet is the same (employees names based on their location) but track different information.
I want to be able to create a macro button that will update all the worksheets if i insert or delete an employee from the master list. When a new row is inserted, the other worksheets should be updated as well with the new name and a blank row to be filled in. And when a name is deleted, the entire row should be deleted as well.
I am looking for a macro that can do one of two things. I am not sure which way I want to go with this yet and how automated it should be. Either scenario will result in a significant time save.
Scenario One 1. Copy & Paste Special Values on the selected/active worksheet 2. Protect Selected Worksheet with password "1234" 3. Delete ALL worksheets except the selected/active worksheet from the file. Names of other sheets can be various and are not static
For example: A workbook has the following: sheets1, sheet2, sheet3, sheet_unknown_name If you are working in sheet1 the macro would copy paste special values the entire sheet, protect sheet1 with the password "1234" and delete any and all other sheets.
Scenario Two 1. Copy & Paste Special Values on the selected/active worksheet into a new workbook 2. Protect the new workbook with password "1234" 3. Rename the new workbook with the original workbook name adding either "em_" to the front or "_em" to the end of the filename 4. File, Send To, Mail Recipient as attachment.
I have a Macro (AutomateReport) that, among other things, calls and runs a macro (ReportStep1) in another workbook.
ReportStep1 includes three prompts asking the user to press "OK" to confirm that the data included is correct. When I call ReportStep1 as part of my larger macro I would like to suppress these prompts or automatically respond "OK" so that I don't have to be bothered with them.
SendKeys works sometimes, but I am hoping for a more reliable method.
i need to create a function macro Called FSTD that inserts words into a cell and conditionally formats them depending on th number in the cell on the left.
in the sheet there are ranges that the number will fall between.
Example
Cell B1 is the cell were i want to run the function in Cell A1 is the cell with the number that is used in the function
Cells A3:A7 are that ranges that i need to use in the function
E.g. if the number in A1 is less than A6 = i want "P" to appear in the cell with a red backround
if the number is greater than A6 but less than A5 = i want "M" to apear with an orange back round
if the number is Greater than A5 but less than A4 = i want "E" to apear with a green backround
even if it is possible to do without changing the backrounds, just to insert the letters
creating a macro, I have a list of CSV files in a folder called balances, i need a macro that will look into each CSV file and grab all p'folios which have a negative balance in Col D and line them up as per example shown below. The extracted data needs to be copied to file named "Workings" S:RecsalancesWorkings
All data in CSV file looks like this, where header row is row 1 starting at A1
I am trying to use the simplest code possible (being a novice) to execute a macro which makes a copy of Cell A1:A4 and paste its values to Cells B1:B4 if cell B5=1 (or whatever). The Macro with copy and paste works (I recorded it and in my testing it was ok). And also the function, that contains If-Then status of cell B5, works and calls correctly the Macro.
Yet when the macro is called by the function (=CopyMyCells(B5)), the Macro (MacroCopy) runs - I tested this with a Msgbox - but stops just in doing what I need, i.e. in doing the copy-paste process. Here the code which is placed in a module of the proper Worksheet (Excel 2003, on WinXPSp3):
i am running a macro thru vba (beiing called from a ms access module) and am getting a RuntTimeError 1004.
the code opens a workbook...then open a second workbook (which houses the macro) then activates the desired worksheet and call the Maco via the run command but errors out.
if i open the workbook and set focus on the desired sheet ....tool>macro>desired macro name it runs fine.
the line of code in the macro is: "ActiveCell.Offset(1, 0).Activate"
i am looking to create a macro that cycles through sub folders within a main fold and takes the same line of nformation from each workbook that it cintains.
the main folder is a yearly folder "2008" there a 12 subfolders within this named "january" to "December" (one for each of the months of the year) Within the monthly folder are four weekly forlders named "week 1" to "week 4"
each of the line in the workbook ferer to a different person so i will need to transfer all of them into individual summary workbooks. but in this example i need to take the information from A3 - K3 from each workbook.
Just need to delete some hyperlinks in column A on 50+ worksheets. Thought a loop through all the worksheets would do it. Only works on active sheet. Forgive my ignorance, don't really even know where it goes, once it works - module or workbook?
"How to create a 'main' macro to control other macros within a workbook". I have my individual macros created. There's one macro for each sheet that searches online data and returns the information. I have one of these per sheet (a total of 20 sheets) since I couldn't find a way to have all 20 macros be on one sheet and still work. My trouble is that whenever I'm on my 'main' sheet and try to run the macro which applies to a 'secondary' sheet, I get an error. I have to select the sheet first, then run the macro and it works. Below is the macro on each sheet.
VB: Sub Holding1() Dim DataSheet As Worksheet Dim EndDate As Date [code].....
Code to run a macro called "PriceForm" instead of clearing the cells.
Private Sub Worksheet_Calculate() Static MyMarket As Variant Application.EnableEvents = False Application.Calculation = xlCalculationManual If [A1].Value = MyMarket Then GoTo Xit Else MyMarket = [A1].Value Range("T5:X50").Value = "" End If Xit: Application.EnableEvents = True Application.Calculation = xlCalculationAutomatic End Sub
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.