VB Code To Find Instances Of Text In Worksheet And Colour Entire Row
Aug 21, 2012
I'm trying to develop code that will perform the function in the title. I want to use an if statement that looks at cells across the worksheet and where it finds certain text it should colour the entire row. I would also like to be able to input the text via a user box. I don't necessarily want the code
View 3 Replies
ADVERTISEMENT
Aug 17, 2012
I'm using WinXP with Excel 2003 - I have a column of highway sign description data (16k+ rows).
Example:
Curve Arrow Right
Curve Arrow Left
Turn Arrow
Reversing Curve Arrow Right
Winding Road Arrow(plus many more unique entries)
I'm using SUM and COUNTIF to total the number of times "Curve", "Reversing", "Turn" and "Winding" appear in the column.
My formula is:
Code: =SUM(COUNTIF($F11:$F16196,{"*CURVE*","*REVERSING*","*TURN*","*WINDING*"}))
Which works great EXCEPT what I really want is the number of cells with any of those key words, not the total count of those words. The example above should be 5, but since row four contains more that 1 of the key words I'm getting 6.
View 4 Replies
View Related
Feb 9, 2013
The problem - I'm trying to find a formula that will find text between 2 characters with unlimited instances in a single string and combine the found text to a single string. The character enclosing the text i'm after will likely be a % symbol. This formula would then be replicated down 5000-10000 rows.
eg. 1 - This is %an% example %sentence% to show what I %am% looking for
eg. 2 - This %is another% example of what I %need%
eg. 1 answer - ansentenceam
eg. 2 answer - is anotherneed
Ideally this would not use a macro as it will be applied to an ever expanding data set but I realize that may not be possible.
View 3 Replies
View Related
Feb 26, 2010
I have an Excel WorkBook with 100 WorkSheets.
Each Worksheet has a unique identifying label - "Requirement Number"
Within each worksheet is free form text data of the following categories:
Requirement: 10358
Title: Customer requirement 1
Text: This describes the requirements for a product for the customer[code].....
The text of the categories may begin in column A or B
What I need is a macro that will search each worksheet for a category, e.g., "Configuration:", copy the row where the keyword "Configuration" is found, and then have that row transposed and pasted to another WorkSheet (e.g., "Extracted Data") cell.
Data extracted from the next Worksheet would begin a new row in "Extracted Data"
Example:
Requirement1 Title Text Verification Method-Level ...
Requirement2 Title Text Verification Method-Level ...
Requirement3 Title Text Verification Method-Level ...
The Requirement# is best extracted from the WorkSheet tab since some of the worksheets are missing this information.
I can provide an example spreadsheet, however, I was not able to figure out how do that in this post.
I found a thread similar to this problem:
find and copy row
However, it only finds, copies and pastes for one keyword.
View 9 Replies
View Related
Feb 26, 2010
I am looking for a solution to an otherwise very tedious problem.
I have an Excel WorkBook with 100 WorkSheets.
Each Worksheet has a unique identifying label - "Requirement Number"
Within each worksheet is free form text data of the following categories: ...
View 9 Replies
View Related
Feb 27, 2014
I have the following code to go through various values in a column and colour code them. However I am facing two issues here:
1. I need to generalize the code such that it runs through column G till column S in different worksheets
2. Few columns between G and S do not have any data and the code is getting stuck at the line below:
myResult = WorksheetFunction.Average(Range("G:G"))
View 1 Replies
View Related
Mar 31, 2014
So I have an option on my userform that the user input selected.
I need the data once written to the worksheet [Master] to move based on cell AD [Customer Divert / TBP Divert / Failed Delivery]
Example: Row 12 has Customer Divert in cell AD I need to keep a copy on the master sheet but also copy the entire row to the customer divert sheet.
Need code and here to input in the Code sheet?
View 7 Replies
View Related
Feb 20, 2012
I have a worksheet with about 20 columns of info. First of which is a primary key. Call it "Job Number." I would like to create a macro that runs down the list of primary keys searching for a specific Job Number I ask for in the new worksheet, in A1. It then copies and pastes the entire row where it found that job number into the new worksheet starting at row 6.
View 7 Replies
View Related
Dec 16, 2008
I need to copy my worskheet multiple times to create about 10 of the same worksheets within a workbook. I know if you click in the very most top left hand corner of the worksheet, then click copy, go to the new worksheet and click paste, it copies the whole page, but it does not copy over the VBA Code.
Also, for some reason, it does copy over my macro buttons, but does not put some of them in the right spot?
View 6 Replies
View Related
Sep 3, 2009
VBA for finding text through an Excel SS and deleting the entire row if the text is found.
For example if the string "STAD LLL" is present in any cell in any string position the entire row is then deleted.
View 9 Replies
View Related
Dec 23, 2009
I am not even sure if what I need is a possibility with excel. I need to "find" specific information and the amount of time that is attributed to it. All of the information is provided via drop down box (times as well) in daily segments then grouped by two week (bi-monthly) chunks and have the total times for each information type placed elsewhere. There are notes placed in the excel file to the right of the information you will see when first opening the file.
View 4 Replies
View Related
Jul 12, 2007
I tried to writer my code myself but I have a long way to go. Here is what I must do for my case:
I want a macro to find the row that include a specific text (For example "SMSC") in a range (A1:A100) then copy this entire row below the cell which has the value "OTHERS". That is, if there are 10 pieces of "SMSC" so these rows including "SMSC" should be listed below the cell "OTHERS"
View 9 Replies
View Related
Apr 17, 2014
I have a lookup that gives and RGB colour code in Cell A1; for example 186, 206, 140.
I'd then like Cells R10:V15 to fill with the RGB colour based on the result in A1.
View 2 Replies
View Related
Jun 5, 2008
I want to catch an error and reset the entire code to the very beginning and skip that entire entry. When I use "Next fieldSheetName" I get "Next without For," error 1004. Searches tell me I have an open block somewhere, but that's not true. Removing that statement (and having the loop iterate as normal) has no error at all.
Dim employeeName As String
Dim fieldMax, x, y As Byte ' Counters mostly
Dim workedHours, fieldSheetName As Integer
fieldMax = 204 ' Row number to stop on in the field time sheet
row = 4 ' Row specification for field time sheet. Begin at row 4 to ignore headers
' and start on the first name. This should not be changed!
Col = 3 ' Start at column 3 then increase by one to start going to next time entry
' RESET HERE!
For fieldSheetName = 4 To fieldMax Step 8 ' This is our MAIN loop. It iterates from 0 to fieldMax, which is 204...........
View 9 Replies
View Related
Jun 23, 2014
I am using the code below in Excel 2013.
Sub Test()
For Each Cell In Sheets(1).Range("J:J")
If Cell.Value = "131125" Then
[Code]....
This works great except that it pastes formulas. I would like to paste values only. I've tried
" PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False" and it gives me an error.
View 3 Replies
View Related
Aug 18, 2013
I am trying to find specific text throughout an excel document (2007) and replace it with the same text but in italics. I tried using the options/format function and selecting italics for the "replace" text but it replaces the entire cell text in italics instead.
View 5 Replies
View Related
Apr 28, 2009
I have four different sheets with email addresses in an excel file. There are some email addresses which are present in more than one sheet. I wanted to find these email addresses and remove its multiple instances.
I can't use the simplified version of vlookup, as I can't enter each email address to see if there is another instance.
Is there a way where the excel sheet can search within itself for duplicate values and if not delete/at least point them out, so that I can delete them manually?
View 3 Replies
View Related
Nov 15, 2013
Why than going line by line on a document that has 60k rows!
I have a document with NAMES in column A and ROLES in column I. If the user has more than one role..their name will be listed in "A" for each role in "I". I'm trying to purge down a file that has 60k + rows. Lets say i want to see all the people and all their roles if they are in "PROGRAMMER_ANALYST" role...can this be done by macros? or formula?
View 2 Replies
View Related
May 20, 2014
I have an input sheet with 3 columns: Currency pair, Tenors, and Value.
Like this:
EURUSD 1m 3
EURUSD 3m 0
EURUSD 1y 5
GBPUSD 1w 2
GBPUSD 1m 9
GBPUSD 2m 1
etc etc for about 100+ rows.
This input is exported from a system we have and may vary in length and values from time to time.
What I want to do is pull all the data for specific currency pairs (probably for 5 of the 10+ currency pairs it displays) onto another worksheet. And for each tenor for that currency pair, i want to perform 10-20 lines of analysis on the next sheet.
So, if GBPUSD was a currency pair I was interested in, I would need 10-20 lines for GBPUSD 1w, 10-20 lines for GBPUSD 1m, 10-20 lines for GBPUSD 2m, etc.
How can I pull this? While maintaining flexibility so if the tenors, currencies, and # of lines change?
View 1 Replies
View Related
Jul 31, 2008
I am trying to write a macro to clean up a CSV file which automatically hard codes titles throughout the spread sheet. I am getting an error on the "FindNext" method below. I am getting "Unable to get FindNext propety of the Range Class" error. Also, the code for the For loop for multiple lines does not appear to be working.
Sub cleancsv()
lastRow = Range("A1").End(xlDown).Row
pmpt = InputBox(Prompt:="What text are you looking for?", _
Title:="Text", Default:="i.e.: Finished Goods Inventory")
numrows = InputBox(Prompt:="How many rows to delete (counting original):", _
Title:="Number of Rows", Default:="i.e.: 1")
Set cell = Range("A1:A" & lastRow). Find(pmpt)
If Not cell Is Nothing Then
For l = cell.Row To cell.Row + numrows
Range("A" & l).EntireRow.delete
Next l
End If
Do
View 8 Replies
View Related
Jan 28, 2009
How can I write a piece of code to initialise an array with all the worksheet names. I cannot be sure how many worksheets will be in the file as it generates different numbers each time.
I used to just declare with sheet names, but I can no longer do that.
arrVals = Array("Subnets1", "Subnets2")
View 9 Replies
View Related
Sep 30, 2009
I am trying to write a formula which finds the last instance of a number greater than 30 in a column (B). The values are not sorted from smallest to largest as they correspond to a time series (A) which needs to be preserved. Ultimately, I want the formula to return the time at which this value occurs, but I think I can do that bit using INDEX
I have a formula to give the first instance (row number) of a number above 30, which seems to work, but beacuse I don't fully understand how it works I can't modify it to give the last instance. The formula is:
=MATCH(1,INDEX(--(B2:B883>=30),0),0)
Having only just learnt how to use MATCH and INDEX, I thought each should have 3 arguments, so I'm confused about how the 4 arguments here work. Also I can't find much on using logic functions within INDEX. Can someone explain this formula, and suggest how I might go about finding the last instance please?
View 6 Replies
View Related
Apr 1, 2008
I have a sheet where in one column, the word "high" will be repeated. I need to find these multiples and then list down in a seperate column the text relevant to each of those multiples (contained in an adjacent cell). I.e if A1 & A3 hold the text "high", take the corresponding values in b1 & B3 and list them in new column C (C1 & C2 continuing in sequential order). I have searched the forums but i can' t seem to find anything.
View 9 Replies
View Related
May 23, 2008
I have a vba routine in my source application that creates a new instance of Excel and opens a new workbook in the new application using the following lines of
Set WoApp = CreateObject("Excel.Application")
Set WoBook = WoApp.Workbooks.Add
Set WoSheet = WoBook.Worksheets(1)
(This is standard code straight out of the vba Help for 'createobject')
The source appplication builds output in the form of worksheets which includes cell content and pictures placed in shape objects.
I need to copy each completed worksheet from the source application into the new workbook.
For example, if MyBook is in the same Excel application as the source then this code will do it:
Worksheets("mysheet").Copy After:=MyBook.Worksheets(1)
But this does not work for WoBook as it is in another Excel instance.
WoBook is recognised by the source. The following code does work:
WoSheet.Cells(1, 1) = "hello"
I have all the right reasons for wanting to do this (without saving the sheet and re-opening in the new instance).
View 9 Replies
View Related
Jan 3, 2013
In my workbook I have two tabs, the first tab is intended to call on data located on the second tab so I can evaluate & Display it in different ways. Here's what's worked so far. Where I'm stuck is attempts to try and combine the two.
- the second tab is named AW_Items_Import
Examples:
1) Looking on the second tab to count the number of times a object (identified on the first tab in Cell B13) appears
=COUNTIF(AW_Items_Import!J:J,B13)
2) Looking on the second tab for items that fall within a set value range, the ranges specified on the first tab in cells C14 and E14
=COUNTIF(AW_Items_Import!G:G,">=" & C14) - COUNTIF(AW_Items_Import!G:G,">" & E14)
What I want to do, is combine 1) and 2) so I can isolate a search to a name specified on the first tab, THEN count the number of times that item falls within a set range, the range also specified on the first tab.
View 9 Replies
View Related
Dec 9, 2009
I want to find a text "Style#" in a worksheet and return the value next to "Style#". The value is supposed to be returned in, say, column H, for each row I found the text "Style#".
Below is the sample:....
View 10 Replies
View Related
Apr 13, 2008
Consider two instances of Excel - one with a workbook containing a chart and some VBA code, the other containing a blank workbook. When I paste a chart from the first instance of Excel to the other, all the VBA code from the original workbook is also pasted into a new third hidden workbook in the second instance of Excel! If that weren't weird enough ON WINDOWS XP (but not Windows 2000) if the VBA code included WorkbookOpen or AutoOpen this code is executed in the second instance of Excel, which of course fails if it references sheets that only existed in the workbook open in the first instance of Excel! This is the first time I've seen the same version of Excel do different things on different versions of Windows! Example attached - What's going on!? Auto Merged Post Until 24 Hrs Passes;...note: this does not happen when pasting charts between workbooks open in the SAME instance of Excel
View 6 Replies
View Related
Dec 27, 2006
I am trying to log a specific portion of code from a webpage. The line of code looks like this:
View Details
I need to extract the userid protion, the part between "=" and "'target...." and then
View 9 Replies
View Related
Jan 13, 2014
I am trying to count the instances of a certain text in a range across 2 columns.
so lets say I have the word Dog in A1, A2, A3, A4 & B1, B2, B3, B4. I am look for the number beside each cell to say 1, 2, 3, 4 instead of summing the whole range.
I have tried the array formula of {=SUM(IF(C:D=C2,1,0))}. However this does just bring back the sum of the instances and I am clueles on how to get it to show the first instance, the second etc.
View 2 Replies
View Related
Nov 11, 2011
I need some vba coding which will find and replace text on a worksheet. This would normally be straight-forward, however some text needs to be replaced by text which already occurs in the worksheet, and without it changing as well (if Find/Replace can perform two Find/Replaces at the same time???).
Here is the detail and what I am trying to accomplish: I have two worksheets each with a table of data.Worksheet 1 has a lookup table with three columns of data (column a and b are lists, with c being a formulated column which is dependent on the user selecting either column a name or column b name). I have done this easily enough using data validation on cell $C$1.Worksheet 2 has a user input table which column 3 is a dropdown validation using the named range "UsedName" from Worksheet 1.
I want the selected dropdown names to automatically change when the user changes Old Name to New Name (and vis-versa) on Worksheet 1.The list of values in the data validation dropdown list change well enough, but not any of the existing returned values. When I tried to use vba coding to Find & Replace, I run into issues because (Substanital and Important) are used in both instances, but at different levels with different matched names Important/Relevant.
Worksheet 1
A B C D
1 Cell with dropdown list New Names
2 (Old Names, New Names)
3
4 Old Names New Names Names Level
5 Equal Equivalent Equivalent 1
6 Dominant Critical Critical 2
7 Important Substantial Substantial 3
8 Substantial Major Major 4
9 Relevant Important Important 5
10 Minor Irrelevant Irrelevant 6
formula for column C =IF($C$1="Used Names", A5, B5)
column C is name ranged "Names
Worksheet 2
(Worksheet 2 has another table which has various data. One column which is a drop down list being pulled from Worksheet 1)
A B C D
1 Bob 25% Critical 19
2 Frank 60% Important 33
3 Ellen 40% Substantial 5
4 Ellen G 20% Substantial 12
5 Gary 55% Equivalent 100
6 Jo 50% Major 8
7 Peter 40% Important 22
8 Kim 12% Equivalent 30
9 Shelley 75% Substantial 15
10 John 75% Critical 90
so I want column C to automatically change from these New Names to the corresponding Old Name of the same level. So Critical would become Dominant, Important would become Relevant and Substantial would become Important.
View 7 Replies
View Related