How To Find And Delete Columns Containing A String
Apr 18, 2014
I'm looking to loop through a worksheet with over 1000 columns and would like to delete columns containing a percent sign (%) in the header row which is row 4. Column range to search would begin at column 12.
View 4 Replies
ADVERTISEMENT
Feb 25, 2009
Find part of string and delete. I have the following type of string:
View 4 Replies
View Related
Feb 24, 2007
I'm using a query that dumps information into Excel. The query automatically creates a formula in each each cell. For instance if the first value in the query showed FUNSTUFF, after dumping it into Excel, the contents of the cell would show ="FUNSTUFF". I can just use a find and replace to get rid of the leading =", but sometimes the values of the cells are supposed to have a quotation mark, so using the same method to remove the trailing quote won't work. I need a way to search each cell, check if the last character in the string is a quote, and if it is, delete it.
View 5 Replies
View Related
Jul 9, 2014
Why my code is not working. I am working with Excel 2010. It will only delete the column on the active spreadsheet and not go to next worksheet. Not all worksheets contain the word "Broker".
[Code] ......
Not sure if its something to do with Activecell, try After:=ws.cells(1,1) or passing it in as the active cell stays the same i think.
View 3 Replies
View Related
May 30, 2014
I am trying to match words in two separate columns that are not exact matches. any formulas or codes I can write to do this.Below is an example.
Column A
3m Corporation
Apple Inc
Allstate Corp
State Farm
View 2 Replies
View Related
Feb 8, 2008
I an using Excel 2003. In that i am having 2 columns (A&B). I need to take each value from Column A and search that cell value in Column B. If it is not found in Column B then delete the cell data in Column A. Then take the next cell data in Column A. Find operation and delete if not found. Do it for entire rows in column A. Then repeat that for Column B also. So my final result will be the same cell value in Column A and B. I need VBA code.
View 2 Replies
View Related
Feb 20, 2008
I an using Excel 2003. In that i am having 2 columns (A&B). I need to take each value from Column A and search that cell value in Column B. If it is found in Column B then delete the cell data in Column A. Then take the next cell data in Column A. Find operation and delete if found. Do it for entire rows in column A. Then repeat that for Column B also. So my final result contains uncommon cell value in Column A and B. I need VBA code.
View 3 Replies
View Related
Mar 14, 2008
I'm trying to come up with a formula to find the last row without any data in columns E and F and delete the 10 rows below them. Is there a way to do this?
View 3 Replies
View Related
Jun 14, 2013
Macro code to find several column names in row 1 (which can be anywhere in the work sheet) and delete them e.g. date, month, code, amount etc.......
Excel version 2007
View 4 Replies
View Related
Dec 2, 2006
writing a macro to find the max value in each column and delete all the data points that come after it (or preferably: delete all the data points that come 2 rows down after the max, if possible). There will be many columns of data where the max will come at different positions in the column.
Instead of deleting post-max values, it would also be acceptable to just copy values from the beginning to the max to the same column in a new worksheet.
View 3 Replies
View Related
May 23, 2006
I am having trouble getting my IF statement to test if the cell contains the text "sale" return "X" if not "Y". I need it to search through the text string in that cell and find a certain word, and if it finds that word, retrn a value. I am really having difficulty with is what symbol or function do I use for the logical test? (i.e. =, <>, MATCH, INDEX?)
View 4 Replies
View Related
Jun 13, 2013
Working with a scheduling report and trying ultimately to get it down to a line item report with the associate information and their earliest start and latest end for the week. Already made a lot of fixes to the formatting involving junking empty cells and trash data, but running into a road block on some of the trash data.
Here is the format of the report at this point. Names have been changed to protect the innocent.
Agent: 2366 Bacon, Kevin
Date
Start
End
[Code].....
So what I need is something that will iterate through the report...such as an while and find the cells in column A that start with "Agent:" It needs to compare that cell to a stored value to see if this "Agent:" is a repeat. If it is then it needs to delete that row and the next one and shift up. If it is not then it overwrites this "Agent:" with the previous one in the stored value and continues the while.
I know what I want to do...but not shure on the code cause I am not great at VBA.
Oh...if it matters probably need to allow for about 10k line items to iterate through...right now report is at 6k...but allow room to grow.
View 6 Replies
View Related
Jun 24, 2009
I would like a macro to find the columns named "apple" and "peach" and delete them. These would always be in row 1 but would always be in different column letters which is why I want the macro to simply find these columns by their name and not by their column letter.
And yes, I do mean the entire column altogether, shifting entire columns to the left. Wipe it off the face of the earth
View 4 Replies
View Related
Jul 15, 2009
1. Remove J,K,N,A Columns,
2. In the last O (TIMESTAMP) column, the date is 14-Jul-09 format change it to 07/14/2009 (this format mm/dd/yyy
3.Filter L column (VAL_INLAKH) Remove all rows from whole sheet which has 0 value
4. Column C (EXPIRY_DT) date format is 24-Sep-09 , "dd-Sep-09" change to "Sep" only
5.Merge Column B,C,D,E (SYMBOL.EXPIRY_DT.STRIKE_PR.OPTION_TYP
respectively )
View 3 Replies
View Related
Mar 31, 2014
I am trying to do a sort of index match thing using VBA. What I am attempting to do is to use the prefix of a long number and try to find that exact prefix in a string array, and output that string array value. So this is what I have so far as a test:
[Code].....
So I can match the text exactly so if I put PREFIXB in cell A1 in this example, i will get the msg box saying "YES", but if I make it PREFIXB1231k4j3jj1kj32cj, it will display "NO". I want to get it so that PREFIXB will be displayed in the cell that I put the formula in. So if A1 = "PREFIX1AAA100CF" and cell B1 = "=ABC(A1)", cell B1 will display "PREFIX1AAA".
Now the thing is that these prefixes can have different lengths, but will never encompass the exact prefix of another. So if I had a prefix of: PRE1AB, I won't have a prefix of PRE1A.
View 2 Replies
View Related
Apr 28, 2014
I am currently using this macro for deleting a row if a string is found:
[Code] .....
But I would like to be able to not delete that row, but also to delete the 13 row above that row, including that row too.
ROW 1
ROW 2
ROW 3
ROW 4
ROW 5
ROW 6
ROW 7
ROW 8
ROW 9
ROW 10
ROW 11
ROW 12
ROW 13
ROW 14 - NO MONEY
All this from No Money up to Row 1 will be delete, and loop.
View 3 Replies
View Related
Oct 23, 2013
I want a macro to look at column G and if a cell in column G does NOT contain "Test Case" anywhere in the cell then delete the row. So for example G5 might be "Test Case/Others" - I would not want this row deleted.
View 3 Replies
View Related
Dec 21, 2012
I have some columns in the excel file:
/path1/xyxxx/cccccc/filename12.txt
/path1/bxgdgg/gfdfacc/filenameeee8.txt
/path1/tttwrw/ccefecc/ddddd/filename56.txt
And I would like to delete everything before the LAST slash(just filenames)
filename12.txt
filenameeee8.txt
filename56.txt
View 2 Replies
View Related
Apr 23, 2013
I trying to search for a string in Excel and then delete that row. The code below will do that but I am also looking to delete the next row line out as well. .
Dim ws As Worksheet
Dim lRow As Long
Set ws = ThisWorkbook.Sheets("DSS")
[Code]....
View 2 Replies
View Related
Feb 1, 2014
VBA code to delete all rows that have the day string of Wednesday
The weekdays are in column C2:C?????
View 8 Replies
View Related
Dec 11, 2007
I have data (strings) which looks like this:
000000000001000
000000000392000
000000000003000
no I want to write a routine which delets all zeros from left to right untill the first "normal" number appears.
Result:
1000
392000
3000
View 9 Replies
View Related
Dec 29, 2006
I am having trouble writing a Macro to delete multiple periods at the end of each cell. Each cell looks simiar to this: Blah Blah Blah................... I am using the InStr function to find the first period but it returns a 0 everytime. Here is the code I used to find the period. I want it to delete everything after the first period and store the value back in the same cell. Right now it just stores blanks.
Sub PeriodRemover()
Dim NewContract As String, Contract As String
Application.Calculation = xlManual
i = 2
Sheets("Product Listing by Contract").Select
Contract = Range("A" & i).Value
Do Until Contract = Empty
NewContract = Left(Contract, InStr(Contract, "."))
Range("A" & i).Value = NewContract
i = i + 1
Contract = Range("A" & i).Value
Loop
Application.Calculation = xlAutomatic
End Sub
View 4 Replies
View Related
May 5, 2014
I have fixed headers on row 16, from columns A-AC.
I want to be able to delete the entire column, if the row has a certain string, such as "Chart ID" .
I also want to expand it to include other strings such as "Month" and "Source" . So if it contains any of these words, the columns should be deleted. It should be an exact match (as other headers contain the word "month").
View 12 Replies
View Related
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
Feb 12, 2009
I want to delete a specific words from string but i have a problem with the code below. For example, i wan to delete the word "Inc" only but the problem with my code is that it is deleting from "Incorporated" too and i want only the code to delete only if it finds the word "Inc" only.
View 11 Replies
View Related
May 4, 2007
I am interested in some sort of macro or formula that will strip all of the characters in a cell that come after that last space. My difficulty lies in that the string isn't a constant character count nor is the string always the same.
American Legion Post 8754 Hartford
YWCA Canton
I would like for it to say:
American Legion Post 8754
YWCA
View 10 Replies
View Related
Feb 26, 2008
There are probably simple solutions to these problems but I'm fairly new to Excel and i have spent far to much time trying to figure this out.
I need a macro that will delete rows that do not contain the string "QC"
Only column A is populated and "QC" is always at the start of the string followed by a space then more characters.
I would also like to delete the contents of the remaining cells (cells that do contain "QC") with the exception of the 5 characters (inc space) immediately after "QC"
For example, these 3 cells:
QC 4860 MF 25/01/08 1713 DateUtilsAH F 25Jan2008 VbV defect 4842QC 4529
Would become:
QC 4860
QC 4529
View 10 Replies
View Related
Jan 30, 2008
I need to write a macro that will search column A and find the word hospital or HOSPITAL and if found delete the entire row. The code I have below will do this ONLY if hospital or HOSPITAL is the only word in the cell. However in my column A there are numerous words in each cell i.e Saint Mary's Hospital.
Sub KillRows()
Dim rngNew As Range
Dim rngDelete As Range
Dim aCell As Range
Dim lastrow As Long
Set rngDelete = Nothing
Set rngNew = Worksheets("Sheet1").Range("A1", Range("A65536").End(xlUp))
rngNew.Select
For Each aCell In Selection
Select Case aCell.Value...........
View 5 Replies
View Related
May 22, 2008
Is there a limit on the number of rows and columns that can be deleted in a macro on Excel 2003? I am trying to create a macro that, amoung other things, delets 1119 rows and 54 columns. If I delete the columns first, the rows will not delete. If I delete the columns first, the rows will not delete.
View 12 Replies
View Related
Sep 25, 2007
I had wanted to go through my spreadsheet and concatenate two columns (A & B)into one (A) then delete the duplicate column (B), but have found no way to do that. Now I am trying to search then insert a column prior to the other two, concatenate the data into the new column then delete the columns. I am specifically having a problem with my Range statement and can't figure out how to activate it or discern it after using the Find command.
Sub GroupGender()
Cells.Find(What:="Group", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False _
, SearchFormat:=False).Activate
Selection.EntireColumn.Insert Shift:=xlToRight
With Range("a1", Cells(Rows.Count, 1).End(xlUp))
.Offset(0, 0) = "=RC[1] & "" "" & RC[2]"
.Offset(0, 2) = .Offset(4, 2).Value
End With
Cells.Select
Selection.Replace What:="Group Sex", Replacement:="Grp/Sx", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("A1").Select.......................
View 4 Replies
View Related