Deletes A Row If It Finds A Specified Value In A Specified Column
Dec 23, 2009
deletes a row if it finds a specified value in a specified column (in this instance, "NB" in column E). However, it is very slow and some end users are complaining about the amount of time it takes to run. Here's what I'm using at the moment:
View 5 Replies
ADVERTISEMENT
May 22, 2007
I need a Macro that deletes all cells in column D of all worksheets in a book that are equal to the word "Timeout" and to shift the cells to the right of the "Timeout" cells into the deleted cells but leaving all other rows where the word "Timeout" is not present.
So in the case of Rows 2, 4, 6 and 8 containg the word "Timeout" in column D, I would like cells D2, D4, D6 and D8 deleted and the remaining cells shifted to the left but cells D1, D3, D5 and D7 left as they are.
Here is an example line of data:
16:02:30LEXKRunningprocedure:125sth
16:32:30LEXKRunningTimeoutprocedure:X125sth
17:20:54LSXPRunningprocedure:oxford
17:56:48LSXPRunningprocedure:xoxford
18:48:24LEXKRunningprocedure:125sth
19:18:24LEXKRunningTimeoutprocedure:X125sth
View 9 Replies
View Related
Oct 17, 2006
I need a piece of VBA code to assign to an Excel form that determines the maximum value of a subset of one column whose cognate rows in an adjoining column satisfy a particular value.
View 2 Replies
View Related
Jan 30, 2012
What is wrong with this formula? I have used it before just fine, but sometimes including now it won't work.
PRODUCT_IMAGE Images 244-447439 244-455507 244-455507 244-455508 244-455508 244-455509 244-455509 244-455512
=MATCH(B2,$A$2:$A$412,0)
We can clearly see that we have a match in rows 2 and 1 columns A and B, but I am getting #NA. I have sorted the columns A-Z as well. I have also tried formatting the columns different ways and I still get #NA.
I need to conditionally format column B if it finds a match in A.
View 9 Replies
View Related
May 10, 2009
I have a Macro that finds in Column F duplicates and adds an Alpha Character (A-Z) to the last right position in the filed.(1-12 Alpha/Numeric) .
It's set to check all rows until a specific number of rows are reached. The current code does this until intCount and intRow equals 1500. The number of rows vary in each file.
View 6 Replies
View Related
May 4, 2006
I need a Macro that Copies all the duplicate values in a column (and their corresponding rows) over to a new spreadsheet.
For example,
1 A B C D E F G
1 Z X Y D R M T
2 B 5 7 8 9 0 4
Because 1 is a repeated value in the first column, the macro copies the first two rows over to a new spreadsheet.
View 8 Replies
View Related
Apr 6, 2009
Need a macro that finds the "X" in column A and moves it to the next row. Also when "X" is already at the last row (row 11 in my example) the next move would place the "X" at the first row (row 2). Looping I believe is the correct term. I have attached a simple spreadsheet example
View 4 Replies
View Related
Jun 30, 2008
I am making a macro that deletes #N/A's, but i want to add a few things to it
that should be deleted:
the phrases "total board", "total metal" and "Item", and any non-text (i.e. any
number) that appears.
this is what i have so far:
View 9 Replies
View Related
Nov 3, 2008
I need a macro that searches my spreadsheet for a keyword in Column B. If it finds the keywords (or an array of keywords would be even better), it then deletes the entire row above the keyword, the row with the keyword, and the row below the keyword.
So for example,
(Column B)
1 - Row Above
2 - Keyword Row
3 - Row Below
If the macro finds the text in column 2, it would delete 1, 2 and 3.
I need to have a second macro that performs a very similar function.
it copies the 3 rows (similar to the example below) to a different sheet based on the keyword.
View 3 Replies
View Related
Aug 11, 2006
I’ve got a macro that automatically starts when the workbook is open. The macro finishes with
Application.Dialogs(xlDialogSaveAs).Show
The document will be always saved with a new name. As I just need the macro once when the workbook is created I’m looking for a code that deletes the macro before the workbook is saved. I tried to record a macro while I was deleting another macro, but apparently it is not working (the recorded macro is empty).
Does anyone know if there exists a code to delete a macro?
View 5 Replies
View Related
Mar 27, 2014
What each piece of this code means and what it is doing? The more details the better
[Code] .....
View 1 Replies
View Related
Mar 25, 2013
I have entries that look like this - 300-7188258-1
300-8983980-5
I need to remove the dashes. I find and replace all - with nothing. that has worked for YEARS. Seems simple to me.
Today, when I do it, Excel leaves the "300" and removes everything else. I even did a CLEAN function and it still does it.
View 3 Replies
View Related
Aug 20, 2008
i have this macro made by another member here that looks for "T" in column 10 and deletes entire row if in that row has a "T". I need it modified to also delete if it contains "FT" and also erase if cells is blank.
Sub Macro8()
Sheets("FORMERS").Select
'deletes entire rows based on a text on one row (this case errases all that have a "T" in column 10 (column J)
Dim DeleteValue1 As String
Dim rng1 As Range
Dim calcmode1 As Long
With Application
calcmode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With...........................................
View 9 Replies
View Related
Jun 28, 2006
The file that I am currently working on is getting really big. It is currently 101MB and we aren't done yet. In contains a lot of Macros and also a lot of ordinary excel formulas. I have recently noticed that excel sort of gets unstable with this file. For instance if I select a very large area eg A200:IK19000 and delete it, it only deletes the first entry (A200). What is going on? Is this a typical excel thing? What can I do to fix it or avoid it in the future?
View 2 Replies
View Related
Jun 6, 2007
It takes all numbers in column 4 starting with Row 15 and deletes all duplicates. It then shows the number of times the number was duplicated and puts this number in column 3. MY PROBLEM: The macro searches each line and takes FOREVER! I have data with thousands of lines. I already tried the screenupdating method which really doesn't help that much. Is there possibly a better code for doing this?
Sub Factor()
Dim sID As String
Dim sOldID As String
Dim lLastRow As Long
Dim lrow As Long
Dim lcount As Long
Dim lLoop As Long
lLastRow = ActiveSheet. Cells(Rows.Count, 1).End(xlUp).Row
lrow = 15
sID = ActiveSheet.Cells(lrow, 4).Value
sOldID = "ActiveSheet.Cells(4, 15).Value"
lcount = 1
lLoop = 1
Do While Len(sID) <> 0
If sID <> sOldID Then
If lLoop = 1 Then.................................
View 5 Replies
View Related
Oct 15, 2008
I have a macro that that stops every time I’m trying to delete the sheet. I get this message. “Data may exist in the sheet(s) selected for deletion. To permanently delete the data, prese Delete.” and I have to manually click “delete” to continue running the macro. How can I avoid this stop so that macro runs thru it without stops?
View 2 Replies
View Related
Dec 11, 2008
I need help writing a macro. I only have experience recording them, not writing them in VBA.
I need to check columns A and B for blanks. If A and B are both blank, I want the macro to delete the row and move on to check the next row. I need to perform this macro for the entire worksheet.
View 8 Replies
View Related
Aug 5, 2009
I'm using the following code to delete columns:
Dim rng As Range
Dim i As Integer, counter As Integer
Set rng = Range("1:1")
i = 1
For counter = 1 To rng.Columns.Count
'If cell i in the range contains an "x",
'delete the column
If rng.Cells(i) = "x" Then
rng.Cells(i).EntireColumn.Delete
Else
i = i + 1
End If
Next
My problem is that I have cells in other worksheets linked to the worksheet that is running this macro and everytime I run it, I get a handful of "#REF" errors. I think this problem might be solved if I could simply delete the contents of the column rather than deleting the entire column. How can I modify my code to do this?
View 4 Replies
View Related
Sep 13, 2006
I am trying to parse and remove unwanted rows from a very large text file using At the moment, the application runs rather slow and was wondering if the experts could give some pointers on how to make the code more efficient while still keeping it simple so others may be able to modify later. I am keeping the ScreenUpdating True as the alternative false will just show Excel as Not Responding to the user until the VB is finished.
Sub deleteReplaceRows()
Application.ScreenUpdating = True
Dim DeletedRows As Integer
Dim lastRow As Long
Dim Arr(7)
Arr(1) = "<PUZZLE>"
Arr(2) = "<%"
Arr(3) = "%>"
Arr(4) = "Response."
Arr(5) = "</PUZZLE>"
Arr(6) = "<HINT>"
Arr(7) = "<MESSAGE>"
For i = 1 To 7
Do
Set rng = Columns(1).Find(Arr(i))
If rng Is Nothing Then Exit Do
rng.EntireRow.Delete
DeletedRows = DeletedRows + 1...................
View 2 Replies
View Related
Oct 17, 2006
I think the loop is deleting my previous entries and only putting the last results in.
For assortedrowindex = 3 To 400
targetdate = Date
Do While Month(targetdate) = Month(Date)
Redim Preserve arrTransactions(assortedrowindex - 2)
arrTransactions(assortedrowindex - 2).CUSIP = Cells(assortedrowindex, 12)
arrTransactions(assortedrowindex - 2).OrderDate = Cells(assortedrowindex, 9)
arrTransactions(assortedrowindex - 2).BuyCurncy = Cells(assortedrowindex, 2)
arrTransactions(assortedrowindex - 2).SelCuurncy = Cells(assortedrowindex, 4)
arrTransactions(assortedrowindex - 2).Fund = Cells(assortedrowindex, 7)
arrTransactions(assortedrowindex - 2).SettleDate = Cells(assortedrowindex, 10)
arrTransactions(assortedrowindex - 2).BuyUnits = Cells(assortedrowindex, 15)
arrTransactions(assortedrowindex - 2).FxRate = Cells(assortedrowindex, 16)
If targetdate < arrTransactions(assortedrowindex - 2).SettleDate Then
' Sheets("Sheet2").Activate...............................
View 4 Replies
View Related
Jan 19, 2012
Below is an extensive macro that basically writes data from a user's template to a certain data sheet (in the form of rows) depending on their "service group." There have been 3 separate instances of a user saving data and instead of adding rows onto the bottom of the entire list of data, the sheet only has their data and no headers/filters. I believe it is somehow deleting all the previously written data that was on that sheet.
I should also mention that this is a shared workbook. I specifically created separate sheets for each "service group" to eliminate the possibility of users overwriting each other's data (Perviously 60+ users were saving to the same sheet and running into conflicting changes errors. Now the max users writing to one sheet is 10-12). Since it is not occurring every time, I am not sure where the error is. Could it possibly be in the sort or delete sections in bold below?
I am using Excel 2003.
Code:
Sub SaveData_Test()
'---------------------------------------------------------------------------------------
' Procedure : SaveData_Test
' Author : Julie/Cecil
' Date : Fri, 1/13/12
' Purpose : Modified Julies code to capture date entries
' associated with hours logged per category.
' Check notes attached to "sOp" string comment
' for additional details.
[Code] ..........
View 5 Replies
View Related
Jun 16, 2007
I'm practicing my VBA and can't get this practice code to work, the syntax looks good but all it does is set the current cell to 23. and I want it to keep going up the column until it find a cell with any value and then change it to say 23. if the value is empty it should keep going up.
Sub chngevalue()
If ActiveCell.Value Is Nothing Then
ActiveCell.Offset(-1, 0).Select
Else
ActiveCell = 23
End If
End Sub
I did check the internet and my reference books and wasn't able to find a clear reason.
View 3 Replies
View Related
Feb 4, 2009
how to put together a macro for a command button that deletes rows with certain text in a docyment - which worked fine a week or so ago - but now the macro will not work.
I made changes to the document - but made sure i also made changes to the code.
View 2 Replies
View Related
Jun 1, 2009
I am trying to do here is select a value from a drop down which is linked to a formula which triggers the macro shape..i have all that down already... but the problem is that I will have multiple values in the same drop down and I needed to figure a way to delete the previous macro shape in that range. And so i have created the delete all shapes code below but it seems whenever I use the code it deletes the data validation drop downs
here is what I have so far...
Function Macro()
'
DELETEALLSHAPES
'
'
ActiveSheet.Shapes.AddShape(msoShapeRectangle, 220.5, 105.75, 92.25, 51#). _
Select
End Function
Function CIRCLES()
'
DELETEALLSHAPES
'
'
View 9 Replies
View Related
Mar 13, 2014
i want delete row E&F depends upon blank cells in range of F:F column...though vba
View 6 Replies
View Related
Dec 17, 2007
I have a macro that needs to walk down a list of values and when it finds breaks in the values, it will insert a formula for a calculation. The problem I'm having is getting the code to loop correctly until it finally finds the value "End" when it should stop (when I play around with the code, sometimes I can get it to continue the loop, but it blows past "End" and then it experiences an error because it can't end.
Sheets("Master").Select
Range("B1").Select
ActiveCell.Offset(1, 0).Select
AssetIDStartRange = ActiveCell.Address
X = 0
Do
ActiveCell.Offset(1, 0).Select
X = X + 1
Loop Until ActiveCell.Value ""
SortCriteriaName = ActiveCell.Value
ActiveCell.Offset(-1, 1).Select
ActiveCell.Formula = "=SUMIF($B13:$B5000," & """" & SortCriteriaName & """" & ",$H$13:$H$5000)"
ActiveCell.Offset(0, -1).Select
If ActiveCell.Value "End" Then....................
View 9 Replies
View Related
Aug 17, 2009
I'm tying to finds the most recent X or O. Then takes the price on that day and compares it to the current price and based on the difference either higher or lower puts out an X if the current price is higher and an O if the current price is lower by the Half StartData - however when i get to about 6 IF statement it freeze up and it wont give me the X or O's ...
View 9 Replies
View Related
May 20, 2006
I'm trying to get a count of the number of workbooks in a directory and it keeps returning 0 when there are three WBs in the directory. What am I doing wrong?
Here is my code.
With Application.FileSearch
.LookIn = "C:Documents and Settingsdt64864DesktopTesting"
.Filename = "*.xls"
.FileType = msoFileTypeExcelWorkbooks
.Execute
MsgBox (.FoundFiles.Count)
End With
View 9 Replies
View Related
Feb 1, 2008
I'm looking to have a row at the top of a worksheet which I can type in, so that only the rows below which contain that information will show up. For example, say I have the following 3 rows, 2 columns each:
Cat Feet
Cat Head
Dog Feet
I'd like to have an additional row so that if I typed in "Cat" only the "Cat Feet" and "Cat Head" rows would show up. Likewise, if I typed in "Head" in the proper column only ""Cat Head" would show up.
View 10 Replies
View Related
Apr 30, 2009
On Error GoTo importError
For Each b In Range("names")
If b = FILE.Sheets("Sheet2").Range("e3") Then
ThisWorkbook.Activate
ThisWorkbook.Sheets("Sheet2").Select
b.Row.Value = n
For Each c In Range("dates")
If c = FILE.Sheets("Sheet2").Range("e5") Then
ThisWorkbook.Activate
ThisWorkbook.Sheets("Sheet2").Select
c.Column.Value = m
ActiveCell = nm
Set Targ = ActiveCell
Targ = system
Targ = FILE.Sheets("Sheet2").Range("e20")
End If
Next
It doesnt work, it gets to b.row.value and throws up an error, i realise im using the wrong code but I dont know enough vba script to resolve the issue
I have a timesheet and a data base spreadsheet, the db spreadsheet opens the timesheet (many, one after another) and I want it to look for each name in the db and if the name cell on the timesheet it has open matches then i want it to remember the row value (on the db), then look through the dates in the db until it finds the matching date to the one in the timesheet, i want it to store this column value (in the db) so I can concat the row and column to get the activecell where I will be putting the total hours (a single cell reference) from the timesheets into the db.
View 9 Replies
View Related