Find Part Text On All Sheets & Delete The Column

Sep 26, 2007

I am trying to move through the worksheets and delete all columns with "Accession" in contained in them. I have to do this with an external macro as the spreadsheet with the data is created from another program. I tried this and get an 'Object or With block variable not set' error and the debug highlights the Cells. Find line of the code.

Also, the number of columns could be variable within the spreadsheet as it is compiled by the other program.


Sub DelAccessionNum()
Dim Wrkst As Worksheet
For Each Wrkst In ActiveWorkbook.Worksheets
Cells.Find(What:="Accession", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False _
, SearchFormat:=False).Activate
On Error Goto Completed:
Selection.EntireColumn.Delete Shift:=xlToLeft
Completed:
Next
End Sub

View 9 Replies


ADVERTISEMENT

Find Text In Column & Delete All Rows Below

Jun 10, 2008

I am trying to create a macro that will delete everything below a certain word.

The code I tried to use is the following. This produced an error:

If Range(Cells(1, 1), Cells(180, 1)). Find(" Interest Expense").Row = 0 Then
iStart = Range(Cells(1, 1), Cells(180, 1)).Find(" NET INCOME").Row + 1
Else
iStart = Range(Cells(1, 1), Cells(180, 1)).Find(" Interest Expense").Row + 1
End If
Rows(iStart & ":" & FinalRow).Delete shift:=xlUp

View 4 Replies View Related

Find Part Of String And Delete

Feb 25, 2009

Find part of string and delete. I have the following type of string:

View 4 Replies View Related

Delete Row If Cell Contains Certain Text As Part Of Text String?

May 15, 2014

I have a column of data with letters in each cell, no numerical, only alpha. Now, some of those cells contain the letters "adj sub" as part of the text string in each cell. "Adj sub" is always at the beginning of the text string. As an example, a cell will look like this - "adj sub mhm". I want to delete rows whose cell description does not contain "adj sub" as part of the text in the cell.

View 5 Replies View Related

VBA To Delete Part Of Text String

Aug 15, 2014

I am trying to delete part of a text string for a range of cells. The code I have so far deletes the first set of letters but is looking in every cell in the range.

Ideally I would like it to only look in the cells of col B where there is data then only delete the first 10 letters if the cell begins with "Service ID"

Sub DeleteServiceID()
Dim c As Range
For Each c In Range("B1:B1000")
c.Value = Right(c.Value, 10)
Next c
End Sub

View 4 Replies View Related

Delete Part Of A Text Line With Excel?

Jan 29, 2014

I have a text document with 1000 lines. All the lines are in this format

important< %#$ other words
other important thing < %Z$different words
some important text < $# some other words

I want to know if is such a excel filter that will delete all the characters starting from "<" until the end of the line.

So, the output of this 1000 lines will look something like this:

important
other important thing
some important text

View 4 Replies View Related

Delete Middle Part Of Text String

Mar 30, 2009

I am looking for a formula to delete information from the middle of a text string. I have ~ 1,000 lines of data. Each text string is composed of the same way. The data I am looking for is two parts of the string (1) all the text up to and including the first “%” character (2) the last six characters.

Raw Data
CARDINAL HEALTH 5.5%13CARDINAL 5.513 CARDINAL HLTH 5.5 061513
UST BILL 0%09US TREAS BILL 0%09 UST BILL 0.0 092409
WORLD SAVINGS 4.125%09WORLD 4.125%09 WORLD SVGS 4.125 121509
JP MORGAN 5.375%12JP 5.375%12 JPMORGAN CHS5.375 100112

Desired Result
CARDINAL HEALTH 5.5% 061513
UST BILL 0% 092409
WORLD SAVINGS 4.125% 121509
JP MORGAN 5.375% 100112

View 2 Replies View Related

Find Text In Range With Part Of Text

Aug 27, 2006

I'm trying to create an Excel function that allows me to choose a row from a table based on text found within entered data. For example, say I have a table called "categories" that looks like this:

Categories
cat
dog
mouse

Now in a different section of the workbook, I want to be able to enter an arbitrary number of sentences, one per row, that look something like:
"It's raining cats."
"The mouse is hiding."....................

View 3 Replies View Related

Delete Rows If Column Has Fewer Than X Matches To Part String Match

May 5, 2008

I have data sets on multiple worksheets within a workbook (over 70). Based on the begining of a string, I need to count all instances with that begining, and if there are fewer than 12 instances, delete the entire row.

Data set example:

In this example, I need to count each instance of rows starting with 1/* - 9/*, and delete rows as mentioned. In other data sets the string might start Gi1/*, and so on. In the following code, if I do not loop, and only test against 1 value type, and ONLY run it once, it works. As soone as I try to loop through all possibilities, or run the macro a second time, it blanks out the entire worksheet, starting at row 3.

Dim c As Long
c = Worksheets(i).Range("A" & Rows.Count).End(xlUp).Row
With Range("A3:A" & c)
If Application.WorksheetFunction.CountIf(Worksheets(i).Columns(1), "1/*") < 12 Then
. AutoFilter field:=1, Criteria1:="1/*"
.Offset(1).Resize(.Rows.Count - 1, 1).EntireRow.Delete
.AutoFilter

I have also tried to concatenate a variable with my CountIf criteria, but that fails miserably.

View 6 Replies View Related

Find Part Words In Column In Another & Copy

Feb 22, 2008

see attached spreadsheet. In sheet 1 I would like to look up each word in column D, seeing if they are in column B at all. Note if the word "Jill" is in D and "jilly" in a surname in B I would like it to get picked up. I have highlighted manually those that would get picked up. Those that do get picked up I would like to be copied into column C as per sheet 2 (this is what I would like it to end up like). There is a very long winded way of doing this using a find function and 1 column per word but as the actual sheet i'm using has thousands of different words this isn't really viable!

View 8 Replies View Related

Find The Part Codes Having Some Indication And Arrange Them In A New Column

Feb 19, 2010

My question is how many parts havinig end with C?Also arrange these parts in ascending order in a new column. Refer to the attached file and expected result also.

View 5 Replies View Related

Selecting A Part Of Text From 1 Column And Put This In A New Column

Oct 22, 2013

I need to put a part of a text from a column and place it in a new collumn. At this moment I use 2 columns and an extra sheet to solve this.

I have a collumn with a lot of data like:aaa-bc

bbb
abc-ba-bd
aa-bb
bbb-xx-yy
aa
abc-yy
klmn-zz
klmn-yy-ff

What I need is behind every cell a new cell with only the 1st part like:aaa

bbb
abc
aa
bbb
aa
abc
klmn
klmn

What I do now is use a new column with this formula:

[Code].....

And I made a translation table in which the 1st 4 characters are translated to what I want to see. In a 3d column I use

[Code]....

to get the results I need. Since I need to get results like this very often this method is very time consuming.

Is there a formula available I can use with only 1 new column?

View 2 Replies View Related

Copy Last Part Of Text And Paste To Next Column

Nov 15, 2012

Example: A1, I go to school (001). I would like to copy only (001) and past to B1. like that and process to the last row of A1. or I would prefer manual last row.

View 9 Replies View Related

Find Value On Multiple Sheets & Delete Corresponding Range

Jun 11, 2008

I'm building a course registration workbook and am working on the unregistration macro.

I have a seperate worksheet for each course, labelled by the course code.

There is also a page for each registered participant that shows what courses they're in.

The macro reads off the information on the participants page, and then should goto each registered course's page, look in column C for their name, find it, delete the contents of that row for Columns C to G (has their other information) and then shift all CELLS (not rows) below the now deleted cells up 1 to keep track of the order they were added.

I've tried recording my own macro and editing... but it doesn't work very well for this.
I've also tried searching and come up with nothing, but if someone can look at my code, and/or point me in the right direction, it would be greatly appreciated.

For Each ws In Worksheets
'checks only course sheets that match the courses the individual is registered in.
If ws.Name = unregisterCourse1 Or ws.Name = unregisterCourse2 Or ws.Name = unregisterCourse3 Or ws.Name = unregisterCourse4 Or ws.Name = unregisterCourse5 Then

'Should search for the variable "unRegister" in column C and select it.
Cells.Find(What:=unRegister, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Select

'Now needs to select the four cells to the right as well (C:G) and delete them

'Select all cells below from C:G and shift them up one.
End If
Next

View 5 Replies View Related

Delete Row With 0 In It Across All Sheets In Column A

May 23, 2013

Below is my code.

It opens a file, does nifty offset formula to compact rows A and B to rows E and F. The problem, is once it is done it leaves a trail of 0's in cells that had no data in the original file.

I have been trying to figure a way to just delete the rows in column A that have a zero in each worksheet (there are 7)

Code:
Option Explicit Private Sub CommandButton1_Click() Dim fromwb As Workbook Dim ws As Worksheet Application.ScreenUpdating = False ' Opens file to select With Application.FileDialog(msoFileDialogOpen) .Filters.Clear .Filters.Add "Excel 2007",

[Code].....

View 6 Replies View Related

Find The Column Name Purple & Delete The Whole Column If There Are No Blank Cells

Mar 18, 2009

I'd like a macro that does 3 things..

1. Find the last row (cell) of data in the "Customer Number" column. This search should be by the name "Customer Number" rather than by column letter because the column that "Customer Number" will be in can change.

2. Find the column named "Purple" (also by name for same reason)

3. If the "Purple" column has no blank cells in those same number of rows as the "Customer Number" column, delete the whole "Purple" column.

View 11 Replies View Related

Remove First Part Of String Of Text And Keep The Second Part?

Feb 12, 2014

Is there any way to remove the first part of a string of text in a cell and save the second part?

The first part of the text string is a team code that has a variable number of numbers, capital letters and sometimes spaces. The second part of the text string is a variable number of words in a team name that all start with a capital letter and have lower case letters. Every line has a different team code and team name.

The original spreadsheet also has a column with just team code. Is there a way of using this column to "subtract" the team code from the text string to just leave the team name?

View 5 Replies View Related

Find And Match The Data In Column In A With Column B And Delete Both

Mar 28, 2014

I need to find the data in the sheet SKU & match it to the data in import_215 column F if it matches then delete the entire row (see Attachment SKU3)

View 12 Replies View Related

Find Part Of Text Within Cell And Replace From Another Cell

Nov 24, 2008

I need to find the "x" in range C2:C44 and replace it with a value (variable) specified in cell I2

The catch is that I then need to be ablt to change that character when I2 changes.

Coloum C
*VER
*T’x’STATUS
*ON
*OFF
*T’x’BANDS

EG

I2 - Variable = B
*T’x’STATUS will become *T’B’STATUS

I2 - Variable = A
*T’x’STATUS will become *T’A’STATUS

But " *OFF " should not change.

I can change *T’x’STATUS to *T’B’STATUS but then I can change *T’B’STATUS to *T’A’STATUS

Please see attached example file as it shows it better than I can explain it.

View 11 Replies View Related

Find Text Delete Values

Dec 2, 2009

I need to change the value of cells if column I contains the word error ....

View 14 Replies View Related

VBA - Find Text And Delete Entire Row

Sep 3, 2009

VBA for finding text through an Excel SS and deleting the entire row if the text is found.

For example if the string "STAD LLL" is present in any cell in any string position the entire row is then deleted.

View 9 Replies View Related

Find Text & Delete All Rows Below

May 17, 2008

I have a report that comes in a txt file. After importing into excel i am left with a bunch of garbage that i dont need. This report is anywhere from 5-15 pages depending on how much product was made that shift. I only need the information off of the 1st page. My question is how can i Find the first occurance of specific text (Site) (will be in column A) and have it select that row and all rows below and delete them.
My biggest issue is the first page can be anywhere from 40-60 rows so I need to find the text (Site) and delete everything below it, which could be anywhere from 500-1500 rows.

View 2 Replies View Related

How To Delete Rows With Strikethrough On Column A Among Multiple Sheets

Nov 24, 2013

I have a workbook with multiple sheets. I want to use VBA macro to delete the row where the first column is strikethrough. I try to the follow VBA code but it doesn't work.

Sub Macro1()
Dim cell As Range
Dim delRange As Range

[Code]....

View 3 Replies View Related

Find Value In Row And Delete Column

Aug 28, 2012

Can we find a value in Row 1 of Sheet called Sheet1 and delete the entire column if the value is found?

The value is in Cell F15 of sheet called Sheet2.

View 3 Replies View Related

Find Cell With Matching Text And Delete?

Dec 28, 2013

I'm looking for code to find a copy of the text in cell AH3 in a range AH7:AH100 then delete all copies of the text in that range AH7:AH100 leaving other cells in that range which contain different text intact.

View 3 Replies View Related

Find Value In Column & Delete All Rows Below

Feb 23, 2009

I have searched high and low for a more efficient macro than the current loop i have. I have a range that varies in size but always follows the same format. After i reach a certain value output from a formula, "4", I want to delete all lines below that line. So I want to find value "4" then move one row down and delete all lines to line 2004. I have attached the macro that i compiled but it takes a couple of minutes to run.

Sub manual()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
. ScreenUpdating = False
End With
With ActiveSheet
.Select
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView.................

View 2 Replies View Related

Find Column, Cut, Paste And Delete

Aug 1, 2006

The idea is that i have several monthly data in columns. I also have a subtotal column that can be a "Total Trim I", "Total Trim II", "Total Trim III" or "Total Trim IV". I also have a yearly total: Jan Feb Mar Total Trim I Apr May Jun Total Trim II Total 2005

I wanna cut the "Total Trim I" column, paste it after the Yearly Total and cut and paste the "Total Trim II" after the "Total Trim I" column for every year... It'll look like this: Jan Feb Mar Apr May Jun Total Trim I Total Trim II Total 2005. But not every trimester has 3 months... I've been thinking about a find function but i have troubles with the implementation.

View 2 Replies View Related

Macro To Find Reference In A Column And Delete Everything Below It

Oct 18, 2009

I have a file here included which has 8 + columns. I normally have to go through each column and find when the references start and delete everything below it. If i could have a macro find where the references start in each column and delete on down that would be a huge time saver.


#REF!
#REF!
#REF!
#REF!

Thats the example of the reference i run into, i was thinking of a macro to find where the REF starts and delete that cell and everything on down.

View 11 Replies View Related

Find The Next NULL Value And Delete Remaining Column

Feb 4, 2010

I am paste valuing from one sheet to another. The size of the data changes each time so to manually delete all Null cells is a pain.
If I do not delete them it sucks up 3 megs of space. I have searched the board several times looking for a solution, lots of discussions but no solutions.
It would be great if I could find that first cell that contains the Null string and then delete the cells remaining in the column. Any suggestions would be greatly appreciated.

View 9 Replies View Related

Find All Cell Values In Column And Delete Row

Jan 25, 2008

My code is always failing on the findnext method. I'm thinking that the findnext method fails because it loses it's cell reference when the row gets deleted.

Sub findwbs()
Dim rngFind As Range
Dim strFirstAddress As String

View 9 Replies View Related







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