Search Cell From External Book And Delete Row If Found
Sep 19, 2009
I have two workbooks, one is used for importing items to the site while the other is a monthly product list. In each of these I have a list of sku codes. I need a macro that will search each sku from the import to the entire product workbook. If it's found then delete the whole row from the product workbook. I have attached the examples below.
View 6 Replies
ADVERTISEMENT
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
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 17, 2013
I have a excel 2007 workbook that has 5 sheets "MASTER" , "RED" , "WHITE", "GOLD" & "BLUE". There are 7 columns in each sheet and the master has about 8,000 rows . In column D of each sheet there is a unique number (approx. 8 - 10 digits ) that I would like to at the press of a command button search through sheets "RED" "WHITE" "GOLD" & "BLUE" against the unique numbers in the "MASTER" sheet and if there any duplicates numbers delete the entire row but leave all the data in the master sheet.
View 2 Replies
View Related
Nov 15, 2006
I have several links to external workbooks that cannot be found...
I have deleted all Name references that posses a ref#
Also I have tried to change the source to the workbook that I am using, but I keep getting a message that says invalid reference to external workbook! In other words it won't let me change my source
I have several work books that I want to change there source, or even get rid of because I can't update them anyways and I don't think it matters if they are updated!
View 9 Replies
View Related
Dec 7, 2006
Is it possible to search a worksheet that may contain different number of rows (from day to day) and for every instance of a word like "HOLD" is found in column "C" to Color that intire Row Red and also Bold the Row as well?
View 9 Replies
View Related
Feb 14, 2012
I want to delete if my sheet have a value miles away
Sample
A1=0 miles away
a5=25 miles away
a30=50 miles away
how i delete these
a1=""
a5=""
a30=""
"' means null
View 2 Replies
View Related
Jan 17, 2013
I have two sheets with data. I wont excel to look for a value in colum A in sheet 2 the value to look for is defined in colum a in shet 1. If value is found it should insert in sheet one the value that is in the cell next to the found value. The data is not sorted. I have attempted and failed with using different functions.
View 1 Replies
View Related
Jul 8, 2014
I have a file which has in excess of 12,000 rows of data in 5 columns (sample file attached with fake data). The five rows are:
"First Name" "Last Name" "Name" (uses CONCATENATE to combine column A & B) "Email" "Date Attended"
There will be duplications in the list as people will have attended more than once over the years.
What I want to do is search through the email addresses (Column D with D1 being the header) and where there is a duplicate email address copy the cell to the right of the duplicate (F#) into the next available cell to the right of the first occurance and then delete the row with the duplicated email address.
I am on Windows 7 and Excel 2010
View 4 Replies
View Related
Mar 22, 2011
I need a formula or VBA macro to do the following:
I have 2 worksheets, namely sheet 1 and sheet 2.
Sheet 1 contains data in columns A to H.
Sheet 2 contains data only in column A.
I want Excel to check the data found in column A of Sheet 2 with those in Column A of Sheet 1. Hence, when an exact match is found in Column A of Sheet 1, Excel will delete that entire row.
View 4 Replies
View Related
Oct 22, 2009
The below code is what I have and it works but what I need is for it to loop until it doesn't delete anything. How can this be done?
View 2 Replies
View Related
Feb 8, 2012
I manage to do a proper search and the return value is correct, but the problem is when I don't get the correct value excel gives me an error, what I can add to make the result just to give me MsgBox "Not found"?
Code below:
Set Ran = Worksheets(2).Range("A:A").Find(CompName, lookat:=xlPart)
If Not Ran Is Nothing Then
MatchRow = Ran.Row
MatchCol = Ran.Column
End If
View 5 Replies
View Related
Feb 29, 2008
I am looping in Excel to find "NUMBER OF EMPLOYEES". IF found I want to go up one row and replace the first 4 digits with " 9ZZ". The Line 1 data will alway be different so I just want to replace the first 4 digits. I don't want it to effect the rest of the line.
Example:
Line 1 - 100 6300 BRCH TOTALS
Line 2 - NUMBER OF EMPLOYEES
RESULTS NEEDED:
Line 1 - 9ZZ 6300 BRCH TOTALS
Line 2 - NUMBE OF EMPLOYEES
View 9 Replies
View Related
Aug 30, 2007
I have a workbook with a sheet for every month. I have a searchbox searching for a client and jumping to that location. The problem I am having is that it takes me to the last occurence in the workbook if there is more that one client with the search criteria. Do you have any suggestions for a searchbox that whould take me to the first occurence and give me an option to go to the next occurence in the workbook. Please see the code below that I am using currently using.
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim cl As Range, rng As Range
For Each ws In ActiveWorkbook.Worksheets
Set rng = ws.UsedRange
With rng
Set cl = .Find(Me.TextBox1.Value, LookIn:=xlValues)
If Not cl Is Nothing Then
Application.Goto cl
Else
View 7 Replies
View Related
May 1, 2012
I am attempting to delete external named ranges after a sheet is copied out of a source workbook (the template). I have tried both the following codes, but neither one does the trick. The code is in ThisWorkbook (not a module), and I have tried it with the code both in the template and the new doc. The new doc is where I want the names to be deleted (there are no #REF names in the template).
Deletes named ranges based on the reference to the source doc:
Code:
Sub DelRanges()
Dim nName As Name
For Each nName In Names
If InStr(1, nName.RefersTo, "='T:Fin_") > 0 Then
nName.Delete
End If
Next nName
End Sub
Deletes named ranges based on a #REF in the value of the range (this is my preferred method):
Code:
Sub DeadRanges()
Dim nName As Name
For Each nName In Names
If InStr(1, nName.Value, "#REF") Then
nName.Delete
End If
Next nName
End Sub
View 1 Replies
View Related
Jan 22, 2014
I have data in cells B2:E2 and this can go down 100+ rows.
In column B i have invoice numbers but some cells contain the word "Deposit".
I have sorted this data so that the invoice numbers appear first and then all the Deposits.
I need a code to find the first instance of the word "Deposit" and to insert a row so that all the invoices and Deposits are seperated by a single row.
View 4 Replies
View Related
Aug 28, 2007
I need a VBA script that can display a search box on multiple sheets within the same workbook similar to using ctrl + F and search values in column B only. If there is text or the row happens to be empty then it should skip that and only search numbers. Also the numbers in column B range from 50000 to 89000 and if there is a wrong number entered then I want to have a pop up box saying Error: invalid value or something like that.
Sub search_box()
Range("B49000").Select
Cells.Find(What:="some#", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Cells.FindNext(After:=ActiveCell).Activate
End Sub
View 8 Replies
View Related
Sep 8, 2007
In a large spreadsheet that receives external data, I have codes (U, N or V) allocated at various times to different rows as shown in sample worksheet attached. Elsewhere in the spreadsheet, I need to display (for later export) these codes along with their respective number in a sorted list. Please review the attached:
In the spreadsheet you'll see a column of codes, the next column is the data reference number, then to the right is three columns, one for each code. As displayed in the sample book attached, each Code column is to display the data reference number (from column 2)that matches that column's code.
What formula can I use to list these numbers in the appropriate columns?
View 5 Replies
View Related
Oct 18, 2007
I was looking at this VBA code the other day and i was wandering what i meant. I thought if somone could expliane line by line,
Sub CommandButton1_Click()
Dim ThisAddress$, Found, FirstAddress
Dim Lost$, N&, NextSheet&
Dim CurrentArea As Range, SelectedRegion As Range
Dim Reply As VbMsgBoxResult
Dim FirstSheet As Worksheet
Dim Ws As Worksheet
Dim Wks As Worksheet
Dim Sht As Worksheet
View 6 Replies
View Related
Mar 31, 2009
I am trying to write a macro to delete all connections from a very large excel file
I created this file by using a Macro to extract data from a external data source (url's listed on a sheet)
The issue is the 1000+ connections on this file make it next to impossible to operate
I cannot recreate the file
macro to delete all connections in all sheets in a given work book.
[URL]
Macro used :
Sub Dump()
Dim myURL
Sheets("Sheet1").Select
ActiveCell.Offset(1, 0).Select
myURL = Worksheets("Sheet1").Range(ActiveCell.Address).Text
Sheets("Sheet2").Select
Range("A65536").Select
[code].....
View 3 Replies
View Related
Oct 26, 2012
I am using excel excel 2007 in windows 7. I have a search button that works great, however, I want it to also highlight the cell green, when it finds what I am searching for. Here is the code below for the search button I have.
Private Sub CommandButton6_Click()
Dim searchthis As String, Found As Range
Me.Unprotect Password:="123"
searchthis = InputBox("Type Number.", "Property Search")
searchthis = searchthis & "*"
Set Found = Range("A:A,e:e").Find(What:=searchthis, LookIn:=xlFormulas, LookAt:=xlWhole)
If Not Found Is Nothing Then Found.Select
Me.Protect Password:="123"
End Sub
View 9 Replies
View Related
Dec 5, 2013
I found some useful code for copying specific worksheets into a new workbook based on the sheet name, which I have not been able to alter to suit my needs.
I have a workbook that has a Master Sheet that contains a summary of each claim (Name, type of claim, dates, dollar amounts, etc.) and a sheet for each specific claim.
I know I can use the filter feature on the master sheet to view all of the physical damage claims (and one column has a hyperlink to the worksheet for that specific claim). But every month I have to create a report that shows each type of claim, dates, and so on.
I would like to create a macro that can copy the worksheets to a new workbook based on the type of claim it is. I'm thinking something like for each ws in wb if range ("F15") = 1 & .range ("B4") < 30 days from today copy that sheet into a new wb.
Below is a generic and far smaller version of my workbook. The name column contains my hyperlinks to the specific sheet. Each sheet is also named based on the text in the name column (so John Doe's sheet would be named 'John Doe') and so forth.
Date of Loss
Name
Cargo
BI
PD
Paid
Reserves
[Code] ........
View 1 Replies
View Related
Aug 13, 2007
I have the following code to search for serial numbers.
Private Sub CommandButton1_Click()
Dim Message, Title, Default, SearchString
Message = "Enter Serial Number" ' Set prompt.
Title = "Find Serial Number" ' Set title.
Default = "" ' Set default.
' Display message, title, and default value.
SearchString = InputBox(Message, Title, Default)
'SearchString = "Rob"
Set S = Sheets.Application
For Each S In Application.Sheets
With S.Range("A1:IV65536")
Set f = .Find(SearchString, MatchCase:=True, LookAt:=xlWhole, LookIn:=xlValues)
If Not f Is Nothing Then
f.Offset(, 3) = Date
Exit For
End If
End With
Next S
End Sub
I would like to amend this so that (a) if the serial number is not found I get a message box saying "Serial number not found" and (b) if the serial number is found, I would like it to highlight the relevant row (after inserting the date).
View 9 Replies
View Related
Feb 16, 2008
i have a workbook with several sheets in it. i would like to make a userform were i could put a number in a text box eg E045698.then use a command button to search all the worksheets for that number and display the sheet number where that number is in another textbox.
View 5 Replies
View Related
Jul 18, 2014
I made the following code to merge 2 workbooks together.
The code is to be executed when the user has Workbook A opened. (All sheets in workbook KPISWD are supposed to be moved after all worksheets in workbook KPICustomers).
I keep getting a debug error on the code that is supposed to do the actual move and loop until it is finished with all of the sheets in Workbook B.
Code:
Dim KPICustomers, KPISWD As String
KPICustomers = ActiveWorkbook.Name
Workbooks.Open Filename:= _
"W:FacturatieKPI per periode SWD.xls"
KPISWD = ActiveWorkbook.Name
[Code] ..........
View 3 Replies
View Related
Jun 22, 2007
I have the below code, which now looks to see if a file is open or not, if it is, then copy and past 'Data' and if not open the book and copy 'Data'.
I think the code is sort of right, but im missing something, as i keep getting runtime error when i try and copy. Here is the
Sub PrintSaveKPIUpdate()
Dim sFilName As String
sFilName = "C: estCashSales_KPI.xls"
Set Main = ThisWorkbook
If IsOpen(sFilName) Then
' Book is Open.
Worksheets("Setup Data"). Range("Data").Activate
View 9 Replies
View Related
Feb 12, 2014
I am trying to search through column "I" for numbers that are decimals, when the first decimal is found, use the row number that the first decimal appears in the string that populates the bookmarks stored in a word template I have created. The code I have so far checks for the decimal and then populates the bookmarks, however it requires me to input the ranges manually, meaning I can set them as the first row in my tabel. But if the decimal appears in the second row and not the first I'm bookmarking the wrong data. Here is the code I have so far;
[Code] ........
View 3 Replies
View Related
Dec 29, 2011
I have written a macro to convert data from a report exported from Salesforce.com to a format that is acceptable for upload to our website. One of the necessary conversions is to convert values from a Boolean value to a Y/N value. I wrote a macro with a series of search-replace commands such as this:
Code:
'replace 0s and 1s in "Direct Billing" column with appropriate data
Columns("R:R").Select
Selection.Replace What:="0", Replacement:="N", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
This code generates a warning when no "0" values are found:
"Microsoft Office Excel cannot find any data to replace. Check if your search formatting and criteria are defined correctly. If you are sure that matching data exists in this workbook, it may be on a protected sheet. Excel cannot replace data on a protected worksheet."
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
May 6, 2014
I am using this vba to delete if the "field" is found, but how can I do that it will delete only if the "field" is not found?
If NO DATA found, the sheet will be delete.
I want as if "NO DATA" found, do not delete. If "NO DATA" not found, then delete..
View 1 Replies
View Related