Search Down Column And Delete 13 Characters If Starts With 20
Jul 31, 2014
in VBA how would I script to search down column and if the cells starts with "20" delete the first 13 characters?
also if it finds more than 10 empty rows it cuts the loop otherwise I may be waiting a while
View 7 Replies
ADVERTISEMENT
May 9, 2008
I'm using the following code to delete rows that I don't want to include and I've ran into some more things that need to be deleted...
For lLoop = RngCol.Rows.Count To 2 Step -1
Select Case RngCol(lLoop, 1)
Case " Date:", "Skill:", "Agent Name", "~*", "*Train*"
RngCol(lLoop, 1).EntireRow.Delete
End Select
Next lLoop
An example of "~*" would be: ***SICARII***
An example of "*Train*" would be: Ozgrid Train1
It's not recognizing these new cases. Do I have to utilize FIND? (since CTRL+F does work with the given cases)
View 4 Replies
View Related
Aug 30, 2012
I have 4 values in column A (Let's say A1:A4)
These values are also contained in column Q among/with many other values. I am looking for a script that will find these 4 values in column Q and delete them by shifting the cells up. I need something like:
Look A1, If the same value exist in Q column Then delete the same value cell in Q and shift cells up
Look A2, If the same value exist in Q column Then delete the same value cell in Q and shift cells up
Look A3, If the same value exist in Q column Then delete the same value cell in Q and shift cells up
Look A3, If the same value exist in Q column Then delete the same value cell in Q and shift cells up
View 2 Replies
View Related
May 29, 2012
Sub test1()
Dim LR As Long, i As Long
LR = Range("E" & Rows.Count).End(xlUp).Row
[Code]....
I would like this to run over all of the following E F G H I J K L M N O P Basically it is getting rid of any numbers in the sheet and cleaning the following cells up.
View 1 Replies
View Related
Sep 5, 2007
I need a VBA code that will search column H for any value that DOES NOT start with "9" (this is a character field). If it finds a cell that doesn't start with "9", I would like it to delete the entire row. It will need to repeat this process for every cell in Column H that has a value and then stop.
View 7 Replies
View Related
Mar 11, 2014
Column A has numbers starting with 1, 2, or 3 and Columns B & C have various amounts. I would like to get totals or columns B & C for Column A numbers starting with 1.
Tried a few things including SUMIF(A:A,"1*",B:C) with no luck
View 5 Replies
View Related
May 20, 2009
I have tried several methods to delete the entire row if the cell in column 'A' is blank ...
View 9 Replies
View Related
Jul 7, 2009
I've attached a dummy worksheet that shows constant values of 1.00 in columns D and E. In the actual workbook, user action will sometimes cause these values to change to something other that 1.00. The user may wish to delete the action that caused the change.
I need a macro that will search from the last cell in column D upward to the first instance of a cell that is not equal to 1.00 and select that cell and those immediately above with the same value as the first found cell.
For example, in the attached worksheet the search would start in the last cell of Columd D and search upward. It would find cell D23 and upward to D19. These entire rows would be deleted.
View 5 Replies
View Related
Jul 2, 2013
I am trying to auto populate into a column that starts in cell E5 and references cell C5 (along with a dataset in N and O). In cell E6, I copied and pasted this formula and changed all of the C5 values to C6. When trying to use the auto populate cross hair tool, excel changes all N and O cells, from O165 to O166, O167 when they should have remained O165 and N165 for every cell.
=IF(OR(C5<MIN(N9:N165),C5>MAX(N9:N165)),"",IF(C5=MAX(N9:N165),INDEX(O9:O165,
MATCH(C5,N9:N165,1),1),(((INDEX(O9:O165,MATCH(C5,N9:N165,1)+1,1)-INDEX(O9:O165,
MATCH(C5,N9:N165,1),1))/(INDEX(N9:N165,MATCH(C5,N9:N165,1)+1,1)
[Code].....
View 3 Replies
View Related
Feb 5, 2010
I am attempting to perform a cumulative subtraction function that starts over again when the value in a column changes. I have a list that is sorted by a column for item number. The other two columns show the amount we have in stock and the amount being ordered against that stock. The order of rows IS relevant and cannot be changed.
Sample output is attached, with the "given" data outlined in a bold border. The only way I have figured out to do this is to nest a whole lot of IF statements in a formula, which is not very elegant or easy to do, and is limited by the number of IF statements that can be nested.
View 2 Replies
View Related
May 4, 2007
I have this macro for a button that needs to start populating a column
with Xs. I want to populate cell F2 with data from a different sheet with Xs.
ub Create_button_macro()
Dim sButton
Set sButton = ActiveSheet.Buttons.Add(156.75, 36.75, 73.5, 22.5)
With sButton
.Characters.Text = "Program 1"
With .Font
.Name = "Arial"
End With
.OnAction = "Button1_Click"
End With
End Sub
Sub Button1_Click()
End Sub
View 9 Replies
View Related
Dec 10, 2007
Currently I am using the Kickbutt VBA Find Function of Aaron, but I would like to have something that works more efficiently. What I currently do is (assuming all possible values for Column J are A - F):
Find_Range("A", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("B", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("C", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("D", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("E", Columns("J"), MatchCase:=True).EntireRow.Delete
although I just want some code that says: delete all rows except those that have "F" as content in Column J. I already tried something like:
Range("1:65536").Select
For Each cl In Range("J:J")
If cl.Text = "A" Or cl.Text = "B" Or cl.Text = "C" Or cl.Text = "D" Or cl.Text = "E" Then
Rows(cl.Row).Delete
End If
Next
but it also takes much to long. The major problem I think, is that the number of records is variable so I search the entire worksheet...
View 5 Replies
View Related
Nov 13, 2006
I have a sheet A1:R456 provided from an outside source, with many large text entries. In some of them appear various ascii strings such as, but not exclusively: •
It appears these have replaced apostrophe's, dashes, and other types of punctuation and formatting (bullets, etc).
I have used the Find (Ctrl-F) to locate some, but it only works if you know what you're looking for. According to Excel HELP! :o Clean() only strips the lower 32 ascii codes, and I'm pretty sure these are at the high end of the ascii chart.
I don't want to remove them, I want to replace them, but I'm not sure if it should be an apostrophe, a dash, or whatever. So I'd be happy to find them and I'll fix it as best I can.
Any VBA code to locate all cells in a range that contain any high-order ascii (say above 127) and fill with yellow?
View 9 Replies
View Related
Oct 14, 2009
I have a worksheet that I produced from optical character recognition, and there are a lot of funky characters that I need to get rid of. One is a line break or carraige return (I assume it's the same character that I could insert by entering ALT+ENTER). How do I search for this special character to replace it? How do I identify what that invisible character is?
View 2 Replies
View Related
Nov 21, 2009
I have about 700 cells I want to interrogate. Within each cell the following text appears “Estimate – BOLB/02/1234 – Some more text here”. I want to search all the cells and delete the cell contents but leave the “BOLB/02/1234”.
The problem I have is that the string is different in each cell but the format is the same. It always starts with BOLB followed by /, followed by 2 numbers, followed by / followed by 4 numbers i.e. BOLB/**/****.
View 3 Replies
View Related
Nov 24, 2006
I want to search a string for specific characters.
f.e. Begin = "bfPaa2"
I want to look for "P"
So, the answer has to be: Letter = "P" after searching the string
View 9 Replies
View Related
Dec 20, 2007
I have a worksheet with a list of ID Numbers:
for example:
A1001
A1002
A1003
:
etc,
I purchased the book from Mr.Excel and got it last week called VBA and Macros for Microsoft Excel. I can't seem to find the code for macros to search through the cells and then either change the cell colour to highlight the cells that contains an alphabetical character. I am trying to remove all the characters in the cells so only the numbers are left over.
View 9 Replies
View Related
Jun 20, 2007
I have done a search on carriage returns/characters and what has been suggested is not working. I have BOTH carriage returns in the cell and also the boxes (that I assume are also carriage returns. I tried the substitute formula (=substitute(cellref,char(10),)) in excel but it only removes the alt+enter carriage return. I tried the various suggestions of find & replace but the chr$..etc did not work! Is there a formula to clear both in one (not a macro!)..?
View 2 Replies
View Related
Jul 10, 2012
I have a sheet with Names in it. I need to look those names up and find which org they belong to. The problem is the the names have many characters after them, and many names belong to a few orgs, with a the rest belonging to many orgs. (See below)
I have been trying to get a Vlookup to work, but since it can't go left, it won't look up the orgs that don't own at least three names. And I can't get the search to work on the names.
Names:
WSGHG1-8410YFH
WSSMXG-8401B8T
NBSMXG-0310V6R
NBXG-0310V6V
[code]....
View 4 Replies
View Related
Oct 5, 2008
I have a column of values of peoples initials and I want to cound how many times one persons initials occur in those cells. I can do this if the cells just contain one person i.e. "CH" or "DH" but if the cell has two or more peoples initials i.e. "CD DH" I can't do it as it only matches the exact search criteria.
How can I total the numebr of times a required set of initials appears in a specific column of cells? Not bothered is it requires a macro or a formulae, just can't seem to figure this one out.
View 9 Replies
View Related
Apr 29, 2008
I have an formula if statement that returns "deletethisrow" if the test is true.
For every occurence of "deletethisrow" I want to delete the row. The number instances will be variable each time I run the file. So maybe it will find that string, maybe it will find 10 instances. I want to do some kind of loop that won't error out when it cannot find "deletethisrow", but will delete the rows for each instance where it does find this string.
I know it was verbose, but if I just do a loop for a fixed number of loops it will error out if it runs out of rows to delete.
View 9 Replies
View Related
May 16, 2014
Is there a way to force Excel to look at only the first characters in a field when searching?
If I use:
MySearch = Range("C3").Value
Cells.Find(What:=MySearch, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
It will find any instance of the characters entered in C3; however, I want it to find only fields that START with those characters. E.g. if I enter TRA in the search box it will come up with CITRATE when I want TRACLEER, etc.
View 7 Replies
View Related
Feb 19, 2007
I have a keyword list in ColA. about 25,000 phrases.
What I want to do is create a macro button.
when i click on it a pop up box would appear called "Deleting Characters"
It will have to 2 rows, 1 saying "More Than",, the other saying "Less Than"
So, beside these words are input boxes.
So I can type the numbers "2" and say "50"
So it will look at all the rows of data in my ColA (Always from A3 downwards)
and deletes all rows with less than 2 characters and more than 50 characters.
When it is finished a floating box appears saying
"123 Characters Less Than 2 Deleted"
"101 Characters More Than 50 Deleted"
Sub NoOfCharacters()
Dim lastrow As Long, TotP, TotC, AvC
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
If lastrow < 4 Then
MsgBox "Nothing to sort!"
Exit Sub
End If
Range("B1").EntireColumn.ClearContents
Range("B3").Formula = "=LEN(A3)"
Range("B3").AutoFill Destination:=Range("B3:B" & lastrow)
Range("A3:B" & lastrow).Sort key1:=Range("B3"), order1:=xlAscending, Header:=xlGuess
TotP = lastrow - 2
TotC = Application.Sum(Range("B3:B" & lastrow))
AvC = TotC / TotP
MsgBox "Total No Phrases: " & Chr(9) & Chr(9) & Chr(9) & TotP & Chr(13) & "Total No Characters: " & Chr(9) & Chr(9) & TotC & Chr(13) & "Avg No Characters Per Phrase: " & Chr(9) & AvC
End Sub
View 9 Replies
View Related
Dec 18, 2009
I have a querry- file search application macro which searches all directories and subdirectories found within the provided string path and brings in specific data from spreadsheets in those directories. I would like to have the ability to exclude some of the subdirectories which are currently being querried.
I'm wondering if it is possible to add additional code that will allow me to either include or exclude specific directories being querried.
Here's an excerpt of the ....
View 10 Replies
View Related
Dec 28, 2005
"Is there some VBA code which could delete all first, second or third
characters of a text? Could it be done to the three last characters
from this same text and these be displayed on reverse order?"
Example:
AAAASAHDASK
AAASAHDASK
AASAHDASK
ASAHDASK
SADHASAAAA
ADHASAAAA
DHASAAAA
View 14 Replies
View Related
Oct 20, 2012
From the names listed in column A, in the table listed below, I wish to delete everything
to the right of the first two characters.
So the new column A would look this.
A
1
E HAZARD
2
F LAMPARD
3
F MALOUDA
[code].....
View 9 Replies
View Related
Nov 17, 2006
I have a formula which I have been using for testing up till now. =IF(LEN(Q3)
View 4 Replies
View Related
Oct 10, 2007
I am trying to write a macro that will go through each cell in a column with the following format "| 12- 4" or "| 60-11" and will remove the first to character "| ".
There numbers are lengths, the first being feet the second inches. I would like to achieve in a separate column the numerical length (with decimals) multiplied by 1%. My code is as follows I just need help on the conversion.
Sub newLength()
Dim LR, lrow As Integer
Dim feet, inches, Line As Double
LR = Range("B65536").End(xlUp).Offset(1, 0).Row
For lrow = LR To 2 Step -1
If Cells(lrow, "D") <> Cells(lrow - 1, "D") Then
Rows(lrow).Insert Shift:=xlDown
End If
feet = Left(Cells(lrow, "E").Value, 4)
inches = Right(Cells(lrow, "E").Value, 2) / 12 'I need to debug this line, but I suspect there is more I need to do.
Cells(lrow, "F") = feet + inches
Next lrow
End Sub
View 9 Replies
View Related
Dec 8, 2007
Sub rightval()
Dim myrange, mycell As Range
Set myrange = Sheets("Sheet1").Range("A1", Range("A65536").End(xlUp))
For Each mycell In myrange
If Right(mycell.Value, 1) = "." Then
mycell.Value = Left(mycell.Value, Len(mycell.Value) - 3)
End If
Next mycell
End Sub
I'd like to delete the last three values of one cell only if it contains a period.
View 2 Replies
View Related
Jan 22, 2014
See the excel sheet [URL]
I need to delete all the digits before / and also the / - in the valuta columns. But this =RIGHT(B2,LEN(B2)-6) doesnt work It says > the formula you typed contains an error
View 14 Replies
View Related