I am in need of code that will match a variable, "TheName", to the values in a range named "Phases". If a match is made then I want to delete the entire row which the value is matched in.
example:
PHASES
cat
dog
pig
My variable, "TheName" = Cat
I want the code search only the range "Phases" and delete the entire row in which the variable "TheName" is found. so in this case it would delete the entire row in which the value of "cat" was matched.
I am trying to find certain words in a column and delete the word and characters following. For example, Say I have a column of info as seen below. This is a test of me. I am just experimenting with this stuff. Deleted (6/15/01) Let me know what you think. I am not sure about it all, but I guess I will figure it out. riviledge1 (01/05/06) Now let's see what happens when I try to test it.
I want to find all the "Priviledge1 (01/05/06)" and replace with nothing. Please note, the date will change with each record, so I need to figure out how to tell Excel to find "Priviledge1", delete it and the date behind it. So I want to delete "Priviledge1" and the next 11 characters including the space.
from this the plan is that you will be able to select the name of the tab that you wish to delete from a drop down list (which will contain all the tab names) and click on a command button and this will then delete it
In Excel 2007, when I delete a row/cell, text is associated with deleting row/cell but some lines, polygon ... can not associate with deleting row/cell . So the lines, polygon ... in mistake location.
I have data in a column that has numbers letters and characters in, all that I require is the first 9 numbers (these are always the first 9 characters), any idea how this can be achieved.
I m writing a formula that will highlight duplicates. I want to use the supplier code (column D) as the search criteria. can the formula identify these duplicates by entering the word 'duplicate' in column L.
I would like to run a macro that will delete the selected row in a protected worksheet but only delete it if the row does not have locked cells. I want users to be able to delete the rows they no longer need but only be able to delete them if the row does not have formulas that are locked. BTW-I am working in an older version of Excel.
Just finished amending a piece of code to enable me to search for an agents name in a list of files. This is then copied to a new worksheet (named by the name entered in the search). What I need is to cut(or delete) the row from the original sheet (sheet 1 in this case) thus leaving me the remaining list of files. Below is how the code is setup at the moment....(just copies the row)
I have a column that has all the digits in the phone number. What I would like to do is remove the first 8 characters example 111-222-3333. I want to remove all the ones dash twos and dash. Can someone help me please ?
i need is a script that will add two boxes together to get a sum in a third box, but where it is tricky for me is that i need the third box to retain the summed value even when either of the first two box values are deleted.
For example, say i have box A1=10, B1=40, and C1= SUM of A1 & B1 (so C1=50). Easy enough, but where im lost is that i want to be able to delete the value of either A1 or B1 and then have C1 still = 50, so then i can input another value into either A1 or B1 to continue to add to C1.
I have an excel spreadsheet that contains about 1000 rows and about 25 columns. The file contains employee information, name, id, cost center, department, title, FTE...etc. Column E contains the cost center which is a 7 digit number (i.e. 8001234). Within the 1000 rows of data there somewhere to 70 cost centers. I would like to delete all rows where a cost center does not match a list of 13 cost centers. I'm thinking I need some kind of array where I type in the 13 cost centers in the code, but I'm unsure of the syntax within VBA.
Also, the second step of the code I'm looking for is to delete all columns except for Column B, E, J and L. Those, by the way are Name, Cost Center, Job Title and FTE.
I am using this code to populate column J with a date when yes is selected in colum I.
Private Sub Worksheet_Change(ByVal Target As Range) With Target If .Column = Columns("I").Column Then If .Value = "Yes" And IsEmpty(.Offset(, 1)) Then .Offset(, 1) = Date End If End With End Sub
However i also want any value entered in J to be deleted when No is selected.
I want to delete all rows in the column of the ActiveCell when the ActiveCell.value < 0.01. Could you tell me why the code below doesn't work? It deletes the right rows but keeps looping without stopping
Sub DeleteZeros() Dim Col As Long Dim StopRow As Long Col = ActiveCell.Column StopRow = Cells(Rows.Count, Col).End(xlUp).Row
I have some shapes on a worksheet that need deleting on change of a combo box. Unfortunately I'm unable to use the below code as not all the shapes need deleting, just the ones that are named in a table on another worksheet.
For Each s In ActiveSheet.Shapes s.Delete Next s
Also not all the shapes named in the table will be on the worksheet as this depends on what is selected from the combo box.
Public Sub Delete_Blank_PO() Dim iLastRow As Long Dim Rng As Range Dim r As Long Dim x& Sheets("ZF17.4").Activate For x = Cells(Rows.Count, 2).End(xlUp).Row To 6 Step -1 '***set coumn 6 as range With Cells(x, 6) Select Case "" '.Value
I have a spreadsheet with thounsands of rows. Some of the rows I'd like to delete because thier values are below 5%. I wrote a VBA code, which primary function is to look for a cell and delete the row if the value is less than or equal to 5%. The code looks fine but I get an "Infinite Loop" anytime the first row value is not true. Below is the code,
-jungleman1
Sub Delete_Zero_Factors()
Dim i As Integer Dim CUSIP As String
Sheets("Report").Select
Range("B5").Select i = 0
While Not (IsEmpty(ActiveCell.Offset(i, 0).Value)) CUSIP = ActiveCell.Offset(i, 0).Value
I have a list of data (this list is variable) and I want to delete the rows that have the word Revaluation in column L.
I tried the following but it did not work
Sub Delete()
Dim Lastrow As Long, i As Long Lastrow = Cells(Rows.Count, "L").End(xlUp).Row For i = Lastrow To 1 Step -1 If Range("L" & i).Value = Revaluation Then Rows(i).EntireRow.Delete Next i End Sub
I've got some code in workbook A that reformats another workbook B. Basically, it moves all the sheets across to A, creates a pivot table and chart, then saves itself as a variant of the original filename B. The last things it does is to delete the one sheet that was originally in A, and then delete the module that the code is running from (using some code from Chip Pearson):
The fact that a module can delete itself blows my mind - but there are a couple of things I'm not sure about:
1. Presumably anything that's in my sub after the delete module line won't get executed?
2. If the saved-as workbook (Bvariant) is closed without saving, the module is still there when it is reopened. Is there a way to prevent this without putting new code into Bvariant?
I have a large spreadsheet of over 5,000 rows and 20 columns. What I would like to be able to do is find a formula(?) that will enable me to retain rows of data when Cells in column B and column E contain duplicate data but delete entire rows if the contents of cells in column B and E are not duplicated.
For example:
Column B contains Part Numbers Column E contains Manufacturer
If a part number (Cell B)has been made by two or more manufacturers (Cell E), retain all relevant rows.
If a part number has only been made by one manufacturer, however many times, delete all relevant rows.
What I'm trying to be able to achieve is retain data so that I can analyse it when 2 or more manufacturers have produced the same parts.
Private Sub UserForm_Initialize() With AddDelete ListBox1.RowSource = "Phone" End With End Sub (Userform is called AddDelete)
I am trying to remove an item from the list box, by way of 'delete' button (command button) and cannot seem to remove from the list box and the spreadsheet
The list is spread over two columns and I can't seem to find a way of doing it, surely there is something simple I'm missing here..?
In a part of my code I have something that will delete all hidden rows, like:
For Z = 1 To TotalRows - 1 If Cells(TotalRows - Z, 1).EntireRow.Hidden Then Cells(TotalRows - Z, 1).EntireRow.Delete End If Next Z
I've done it in reverse to be quicker, but it's still quite slow. Granted, I am deleting several thousand rows, but surely there's a quicker way? Thinking about it logically I would presume that (in general) selecting stuff first in Excel and then deleting them appears to be quicker, but I'm not sure how to pull that off.