Deleting Multiple Worksheets Which Ends With The Word Data Through Vba Code

Jun 14, 2007

I have many worksheets which ends with the word " data". Is there a way to delete all the data sheets at one go through VBA code.

View 3 Replies


ADVERTISEMENT

Shortening VB Code That Deals With Deleting Row If Type Of Word Is Found?

Sep 17, 2012

I have a file with over 20,000 rows that contain a date (Mon~Sun), What I need to do is remove every day that contains Mon~Sat and only keep Sun, this is the code that I have come up with and is working.

Code:
Dim c As Range
Dim SrchRng
Set SrchRng = ActiveSheet.Range("A1", ActiveSheet.Range("A" & Lastrow).End(xlUp))3

[Code]....

View 1 Replies View Related

Deleting Multiple Worksheets

Mar 27, 2006

My spreadsheet involved plenty of importing of data for Analysis. However the spreadsheet get cluttered very often and i have manually delete the data worksheets.

I was wondering whether is there a way of deleting all the worksheets that contains data(I.E someway of protecting my proccessing and display sheets from being deleted, about 100 of them) or isit possible to delete spreadsheet in a loop with the last char being a number as all my data sheets are named xxx1 ,xyz2 etc and none of my other sheets end with a number

View 9 Replies View Related

Conditionally Deleting Lines On Multiple Worksheets

Jun 17, 2014

I need to delete line if 2 conditions are meet.

If col A is blank and col D or E is blank then I want the line deleted for lines 1no more than 100 The option of D or E has me stymied I end up with it not working right. This is what I had tried

Dim lastrow As Long, c As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For c = 1 To lastrow
If Range("a" & c).Value " " and Range("d" & c). Value " " or Range("e" & c)Then ActiveSheet.HPageBreaks.delete
Next c

But doesn't work

I also need macro to run multiple worksheets which varies anywhere from 12 sheets to 50 sheets.

View 6 Replies View Related

Deleting Multiple Worksheets And Saving Active Worksheet

Aug 3, 2007

I am trying to find a easy way to delete multiple worksheets in a workbook and then saving the workbook based on the tab name of the worksheet.

View 9 Replies View Related

Copying Data From Multiple Worksheets To Multiple Worksheets In Another Workbook VBA

May 14, 2012

I have 2 nearly identical workbooks and I need to update historical data from the old workbook into the newer one.

My current Coding Snippets that I want to use look like the following:

Code:
Sub UpdateWorkbook()
Dim ws As Worksheet
Dim r1 As String
Dim r2 As String
Dim r3 As String
Dim r4 As String
Dim r5 As String
Dim r6 As String

[code]....

Now, this code isn't working I suspect because the Copy and PasteSpecial Functions don't work the way I wish to.

View 4 Replies View Related

VBA CODE IN WORD - FROM Data

Apr 10, 2009

Is there anyway I can get Cell Data to go over to a VBA variable in Word .. Ive tried googling but not coming up with much...

For example.. I have a cell with the number 10 in it... Id like that to get sent over and be assigned to a string variable "Attended" in word....

View 9 Replies View Related

Code Running For Multiple Worksheets

Jun 27, 2014

I have the following code, I have it running to just work on Sheet 2 but I would like it to be able to run on mulitple sheets, not all but a range like from Sheet2:Sheet30.

[Code]........

View 12 Replies View Related

VBA Code For Summing Up Cells On Multiple Worksheets

Jan 13, 2014

I have made a basic holiday planner, where each employee has one worksheet which shows 52 x 5 day weeks.

When an employee asks for holiday, I put a 1 in the corresponding day (cell). What I need to happen is that if 4 first aiders all ask for holiday on the the same date a warning User form loads up.

The names of the 4 worksheets are;

"Jason L 2014", "Sharon L 2014", "Alan B 2014" and "Chris M 2014".

The ranges for the 5 day weeks are

"B7:F7", "L7:P7", "V7:Z7"

"B10:F10", "L10:P10", "V10:Z10"

"B13:F13", "L13:P13", "V10:Z13"

"B16:F16", "L16:P16", "V16:Z16"

[Code] ........

The code should not run the User form until the sum of the same cells across the 4 worksheets = 4.

By this I mean if 3 of the first aiders book B7 off, the code searches the 4 worksheets and if the sum is 3 then nothing happens. However if the 4th and final first aider tries to book the same day off, when the code runs it totals 4 and the User form runs.

View 1 Replies View Related

Code To Copy Excel Data To A Word Document

Apr 8, 2009

If possible could someone please tell me why the below code is not calling the normal.doc macro "testy" and any solutions.

The code opens a new document, pastes the text from the clipboard and then fails to run the wanted macro.

View 6 Replies View Related

Deleting Data From Multiple Files

Apr 21, 2008

I have to delete data from D15 to AZ129, D168 to AZ282, D312 to AZ426 in 46 excel files, saved in the same folder. I go through the process manually by opening each file and then deleting data.

View 14 Replies View Related

VBA Deleting Entire Row When Certain Word Appears?

Dec 12, 2012

I currently have the following code that works great and deletes the row from my spreadsheet when the word "vacant" appears in column F.

Sub test()
Dim r As Range
With ActiveSheet[code]....

The problem is, "Vacant" also sometimes appears in column G. So, as this code is now it is finding the word "Vacant" in either column F or column G and then deleting the row.

How can I write the code so that it only deletes the row where "Vacant" appears in column F but ignores it when it is in column G?

View 3 Replies View Related

Deleting Characters From A Word File

Nov 10, 2006

I'm trying to automate a redundant task. I have several Word files in one central folder. I need to open each file, remove all paragraph marks (via find/replace all), copy the result, and paste it into an Excel sheet. This process will be repeated for each file in the folder.

The code I have is almost there, however, I can't get it to do the find/replace. Below is an extract of my code for the Word application part. The code for the copy and paste will be inserted after the replace action works:

Dim Wapp As Object
Dim i As Integer

WorksheetsLocation = TextBox1.Value ' this is the folder location brought in from an input box

On Error Resume Next
Set wApp = GetObject(, "Word.Application")
If Err.Number 0 Then 'Word isn't already running
Set wApp = CreateObject("Word.Application")
End If
On Error GoTo 0

View 9 Replies View Related

Deleting Replication Of Word In Same Cell

May 29, 2006

I had alot of cells that has replication in the same cell. I would like to find out if the cell has any replication. If there is, delete the repeated data if not go to next cell

Example,

Before
Peter, John
Peter, John, John
Peter, John, Peter
John, John, John
Peter, Peter, Peter

After
Peter, John
Peter, John
Peter, John
John
Peter

[edit] The example above is 1 cell per line [/edit]

View 9 Replies View Related

Macro For Finding Specific Word And Deleting It

Apr 2, 2014

I have a excel file with more then 10 sheets..Some of the sheets contains this word in some random cells" #DIV/0! " I want a macro which can find it in every sheet except parent sheet and can remove it.

View 5 Replies View Related

Searching A Column For A Word And Deleting All Rows That Don't Contain It

Jun 21, 2007

I am trying to create a search function in a database I have made. I have a userform with drop down boxes that people can choose what they want to search for. Once they have chosen and clicked the search button I want it to search only in the relevant column, i.e. search for the word in the dropdown for "engine" only in the "engine" column of the database. Once it has found the appropriate cells with the answer, I want it to delete all other rows that don't include the answer.

Once it's done this it needs to do it again for the other fields, unless they are empty. I have used 'If engine_type <> "" Then' as the starting point so that it only searches chosen fields.

View 4 Replies View Related

Consolidate All Data In Multiple Worksheets Of Multiple Workbooks In One Master File?

Jul 12, 2014

I need a macro that would consolidate all data in multiple worksheets of multiple workbooks in one Master file.

All the workbooks will be in one particular folder. The macro should search for data in all the workbooks and consolidate it in one master excel workbook.

I am currently using both excel 2007 and excel 2010. This macro would really reduce manual work as currently consolidating data from 45 to 50 sheets takes an ample amount of time...

View 4 Replies View Related

Creating Multiple Word Tables From Excel Data?

Sep 17, 2011

I'm working on a national survey with valuable data from students. The plan is to turn around, 100 different reports to the departments with their respective students.

The issue that I have is creating multiple tables from multiple sheets in excel into a word table, any way of automating it.

What the tables look like in excel:

What I want them to look like in word, with a chart if possible:

I realize that I can just copy and paste easy table into word from excel and with a few clicks of a button, get what I want. But i'm looking for something to automate and simplify this process. There are about 300-400 variables that I need to crosstab with certain demographics.

If it matters any, I bought a software package (Q Market Research) but it doesn't make the tables look exactly how I want them to look. The data is from SPSS, those tables are flat out.

View 9 Replies View Related

VBA Code On Transferring Data To Different Worksheets?

Jun 29, 2014

What I am wanting to do is to transfer Names(Row B7:B160) to a different work sheet IF the Row next to it(C7:C160) is filled out with a time. I will be setting up a command button that once say 10 names have times next to it, this data then will transfer to another work sheet.

I have done below coding, however it will only transfer data in B7 and C7, if I try to add B7:B160 it comes back as Missmatch. Below is what I have done for the Command button.

Private Sub CommandButton1_Click()
Dim AdviserName As String, Time As Integer
Worksheets("Sheet1").Select

[Code]....

View 6 Replies View Related

VBA CODE On Pasting On Last Row Of Data For Various Worksheets

Jun 9, 2006

I have got a workbook with 20 or more worksheets. Every quarter I need to paste/append new data on these worksheets (which has already got existing data from previous quarters). All worksheets have different rows of data, for eg One worksheet may have 10rows, the other may have 50. Hence when I am writing my code, I cannot specify the destination cell as for eg A11, or A51.

How do I write up a VBA code that looks for the last row of data on these various worksheets and then pastes the new information on the next row(new row).

View 5 Replies View Related

Importing Data From Multiple Word Forms Into A Single Spreadsheet With Vba

Mar 29, 2009

I would like to use a vba procedure/procedures to achieve the following:
I have a folder with many Word2003 forms in and I want to save just the data from each form and then import the data into an Excel spreadsheet.

Currently I am opening each .doc file in turn, saving just the data to a new plain text (comma separated file) in a different folder and am unable code searching that folder for all the text files and importing them into the spreadsheet.
I have a two part question to my current approach:

1) I am 99% there with the first part (opening and converting the forms) with the following code having followed advice from another thread but I need Word open and not showing an open document. Is it possible to add code to take care of opening Word in the background and close it again after so the process is fully automated?:

View 3 Replies View Related

Remove The Word Total From Each Cell Without Deleting The Numbers After You Copy From A Subtotal List

Jul 29, 2009

if you can remove the word total from each cell without deleting the numbers after you copy from a subtotal list?

View 9 Replies View Related

Macro- Filters Data And Copies To Worksheets Specified In Code

Jan 30, 2009

the following code filters data and copies to worksheets specified in code, can this code be shortened to make the macro run faster. Also in my second criteria how can I put "Contains "PT2" in the criteria as nothing happens when i run the macro, is *PT2?


With shtRec
.AutoFilterMode = False
.Range("A7").AutoFilter Field:=8, Criteria1:="LEHMAN", Operator:=xlAnd
With .AutoFilter.Range
On Error Resume Next
Set rng = .Resize(.Rows.Count - 1).Offset(1).SpecialCells(12)
On Error GoTo 0
End With
If rng Is Nothing Then
MsgBox "No data to copy"
Else
rng.Copy shtLehman.Range("A6")
End If
.AutoFilterMode = False
End With

View 9 Replies View Related

Deleting Worksheets

Jan 29, 2010

I am trying to write a macro that will look through all the worksheets in my workbook and delete any that are called "Data2", "Data3",... "Data#"

So basically I want to find any sheet that has Data and a number after it (with the exception of "Data1") and delete it. Does anyone know of any way to do this?

View 9 Replies View Related

Deleting Worksheets Not Between Beg And End

May 10, 2006

Would anyone have a way to delete worksheets not between worksheets called Beg and End? I am actually looking for a way to delete all worksheets to the left of Beg (including Beg) and all worksheets to the right of End (including End).

View 6 Replies View Related

VBA - Search For Multiple Text Strings In Data Field And If Matched Return One Word

May 7, 2014

I have hundreds of records of customer info and I am trying to categorize the job titles so that I can conduct some analysis with a pivot table. My problem is that there is about 20 different ways and variations of "manager" so Instead of autofiltering for "mrg." "Manager" "marketing manager" ect. and then replacing the text manually and using the enter and fill process (to create some standardization to compare "manager" to "director" to "c-level" to "consultant", etc.) and repeating this process over and over again...

I would like to create a VBA that would search the column "job title" for multiple text strings at once and if the text string was true in the cell then the cell would be replaced by a new text string "Manager". I was thinking a series of if functions within one vba but I am not sure if this is possible.

View 8 Replies View Related

Deleting Worksheets With Macro?

May 2, 2014

I am trying to write a macro that takes the value in cell B2 from a workbook called ""numbers" in a worksheet called "summary," and creates a new worksheet in a workbook called "filestransfer" that is named the same thing as the value in cell B2 from "numbers." That part is done.

View 2 Replies View Related

Deleting Columns In Worksheets

Mar 24, 2014

I tried to write a macro for deleting some columns automatically in my workbook

- it will be applied to all worksheets, except two worksheets called "samsung" and "toshiba"
- columns will be deleted from V to AA and AU to AZ in the related worksheets

Please check my attached file and my macro inside it.

deleting columns makro.xlsm‎

View 5 Replies View Related

Prevent Others From Deleting Worksheets

Jun 6, 2006

I'm on a system using Windows XP with several user accounts. It's possible to share a document by putting it in a directory called, unsurprisingly, "Shared files' or somesuch. Anyway, I wish to put one of my Excel spreadsheets into this directory so that other users can see it. The workbook itself has about 10 worksheets and I want other people to be able to edit only one of them. So I used the "Protect Worksheet" option within Excel to protect those worksheets I don't want edited. However, I notice that it's still possible to delete a worksheet even though its protected. Is there a way to prevent from deleting worksheets?

View 2 Replies View Related

Consolidate Data From Multiple Worksheets

Jan 7, 2009

I have a workbook with 7 different worksheets (site_worksheets) containing data about various sites. I need to copy all this data into a single worksheet (worksheet_a). I want worksheet_a to update itself when another row of data is added to any of the site_worksheets.

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved