Macro Code: Find Cell Or Row Multiple Criteria

Sep 14, 2006

I can't seem to find the answer to this. In VBA, how do you Find a cell or row based on multiple criteria? All I need is to find it's location. If it helps, here's an example:

Sheet 1 contains source data:
Date Name Time Complete

Sheet 2 contains an interactive worksheet using this data. On Sheet 1 there's an entry: 9/12/2006 George 03:30 PM

Sheet 2 displays those records with adjacent cells for entering data. When data is entered, I need the system to go back to Sheet 1, find the entry that matches this one, and put an "x" in the Complete column.

View 6 Replies


VB / Macro Code For Multiple Find And Replace Within One Single Column?

Mar 17, 2014

code to find/replace the letters: "A" with "Active", "P" with "Contract", and "C" with "Settled sale", all in column "Q".

View 2 Replies View Related

VB Macro For Variable Cell Merge Into HTML Code Based On Criteria

Oct 7, 2009

Does anyone have a VB macro that will copy information from a cell (this will be variable based on criteria) and paste it into the middle of another cell that contains HTML code?

The criteria for the copy/insert/paste is that the information in the cell that is to be copy/inserted must match up with the correct number (part number).

I hope this makes sense. I have attached an example spreadsheet. (Pictures are worth 1000 words. ) Hope someone can help. I checked this site and couldn't find anything that was solved that matched the specifics.

View 6 Replies View Related

Macro Used Textbox In Worksheet Rather Than Cell Reference As Criteria To Find Matches

Sep 26, 2013

This is a continuation of thread 182629 [URL] ....

The End User wanted originally to type characters into cell C1 of a worksheet that the macro searched for in another worksheet, copying across every row containing the input.

The responses gave me the following code which worked perfectly:

With Sheets("PICKLIST")
myFind = "*" & .[c1].Value & "*"
End With
If myFind = "*" & "" & "*" Then Exit Sub

Unfortunately, the user NOW wants a Text Box instead of putting the characters into a cell.

I added a textbox (originally called 'TextBox2' but renamed "Choice") and "Dimed" CHOICE As Range.

Then tried the following code:

With Sheets("PICKLIST")
myFind = "*" & CHOICE & "*"
End With

But it generates a "RunTime Error 91" - Object variable or With block variable not set.

View 8 Replies View Related

Macro Code To Find Blank Cell In Column

May 30, 2008

Short and simple. What is the quickest, easiest & most efficient way to find the first blank cell within a column using VBA?

View 9 Replies View Related

Find Text/Value & Use Found Cell, Row, Column In Macro Code

May 10, 2008

I am trying to clean up and simplify my macros by compartmentalizing frequently repeated commands. I like to search for text in column headings and define the cell containing it as a range that I can later use .column or .row commands on, so my macros are a bit more flexible. The code I currently use for this is

Dim XColumn As Range ‘the cell containing the text “X”
Selection.Find(What:="X", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Set XColumn = ActiveCell

I would like to be able to create a Macro (possibly name FindSetCell()) that will accept arguments and achieve the results of the above code in other macros
I think the command might look something like FindSetCell(“text to be searched for”,”name of newly Defined Range”) But I have not figured out how to code it

View 2 Replies View Related

Lookup Via Macro Code: Find The Match And Then Select That Cell In VBA

May 24, 2008

I have a large database of equipment on one sheet and an input form on another. For inventory control, when a user scans a number into the input form, the main inventory sheet is updated with the current location. I have it working using functions, but I need to do this in VBA. I am looking to do the following;

User enters 2222 on the input form. The code matches 2222 on the inventory sheet, moves the activecell 10 columns and updates a value in that cell. Cell A2343 is "2222" then Cell K2343 is changed to "WAREHOUSE 4". What is the best way to find the match and then select that cell in VBA?

View 8 Replies View Related

Macro For AverageIFS With Multiple Criteria In Same Criteria Range

May 18, 2014

Macro for AverageIFS, with multiple criteria in the same criteria range....

View 9 Replies View Related

Using Multiple Criteria, Find Value

Nov 6, 2009

I have 3 columns:

A has a sequential number
B has a date
C has a date

I want to find the first, second, and third occurrance when the following comes up in my list: B=date, C=blank.

View 2 Replies View Related

Multiple AutoFilter Criteria Code

Feb 27, 2007

I'm trying to program a macro that filters out codes in an autofilter list. There are about 40 codes in total, however I only want excel to display 3. The current script I am using is below. I know excel lets you filter for 2 criterias in this format, however is 3 or more too much? What would be the best way around this problem?

Selection.AutoFilter Field:=4, Criteria1:="=COR", Operator:=xlOr, _
Criteria2:="=REM", Operator:=x1Or, _ Criteria3:="=REA"

View 2 Replies View Related

Multiple Criteria Row Deletion Code

Aug 14, 2007

modify the delete row macro below. Unfortantely this is where my brain cell sometimes dies and the easy answers are as apparent as they should be...

Ideally what I am looking to do is have a growing list of "IDS" in one worksheet (call it delete IDS) that will be used to loop thru the sheet named "NRs" and delete the the IDS from that worksheet.

Sub DeleteNames()
'using set column
Dim RngCol As Range
Dim i As Range
Set RngCol = Range("A:A")
For Each i In RngCol
If i.Value = 156916233 Or i.Value = 600093 _
Or i.Value = 156970571 _
Or i.Value = 156948409 Or i.Value = 30560 _
Or i.Value = 163841503 Then _
Next i
End Sub

View 4 Replies View Related

Find Function With Multiple Criteria?

Jul 20, 2012

Find Function with Multiple criterias. Ex-


If this is my data in Column A, I need to find the names which contains " R " and " X " in 16th digit. I can do it using find formula twice but is there a way to do it in on shot..?

The formula I'm using is =FIND(" R ",A1,16) it gives me numbers like 16, 17, 19, 20 etc but I'm interested only in 16 digit so I just filter for 16 and copy the data to seperate tab.

View 9 Replies View Related

Multiple Criteria To Find A Value On A Worksheet

Sep 18, 2006

I am using 2 criteria on one spreadsheet to identify an get a value on another spreadhsheet.

The criteria are Sex (Male or Female) cell C8 and Age (ranging from 0 -100) cell D8.

I want the formual to Look Up the Life Expectency (from the other worksheet) The worksheet has colums that contain age, sex and life expectency.

I can only get VLOOKUP to work with one criteria;

=VLOOKUP(D8,"Mortality Table"!$B$10:$E$109,5,False)

How can I find the Life Expectency utilizing 2 criterial, age and sex?

View 9 Replies View Related

Find Out Oldest Date Using Multiple Criteria

Dec 24, 2012

I want to know the macro code to find out the oldest date in the Calculation sheet of the attachment based on two criteria.

The criteria should be if the Item ID on Calculation sheet matches the Item Id Pivot sheet and then if the Status on pivot sheet and calculation sheet matches then the macro should find out the oldest date for each item ID. And once the oldest date is identified the difference on pivot sheet should be added to the cost basis column on calculation sheet to the already found oldest date lot.

Find the attached excel sheet : Book1.xls

View 4 Replies View Related

Find Smallest Number With Multiple Criteria

Sep 2, 2008

I need a formula that will give me the smallest number based on multiple criteria.

For example, I want to find all:

1. Product A
2. 1 Liter
3. Smallest Price

In other words, out of all 1 Liter Product A's, I want to see the smallest price point.

I tried a sumproduct but I can't get it to work. Something like =sumproduct((A1:A100="Product A")*(B1:B100="1L")*(small(C1:C100,1)))

How can I get the small formula working within the sumproduct? Or is there another workaround?

View 9 Replies View Related

Count With Multiple Criteria And Find Permutations

Oct 6, 2009

I have a few calculations I cannot solve for life of me. I know you guys can figure this out. In the example attached you will see the list of the numbers that were drawn (More numbers will be added as time continues).

I was able to use " countif" to find the total number of time each number was drawn.
My delima, I need:

1. Count the number of times each number was drawn by person.

John starting in cell J7
Mary starting in cell J11

2. I need to type in 4 digits in cell J19, and find all possible combinations from the list of numbers drawn

List what combination of numbers that was drawn including the date it was drawn by person starting at cell I20 using the format as shown

View 9 Replies View Related

Unique Trace Code (multiple Column Criteria)

Aug 20, 2013

I have a challenge I haven't quite been able to figure out:

I need a 6 digit trace code to be automatically generated for each job based on the date, the product type and the job number.

The first 2 digits on the trace-code are alphanumeric and the sequence for each job is AA, AB, AC etc.

The last 4 digits are a date code (YYWW.... two digits for the year and two digits for the week number).

The criteria is that multiple jobs of the same product type within the same work week must not have identical trace codes. So Job 1 gets "AA" plus the date code... Job 2 gets "AB" plus the date code, etc. If Job 3 is done in the next work week, it cycles back to "AA" and gets the new date-code.

Generating the date-code was simple enough, but coming up with a function or rule to assign the two-digit alpha has been a challenge that I have not been able to beat.

Below is an example of how the Trace-code column should work....note that Trace code on one product type might be identical to the trace code on another product type.


Product type
Lot number
Trace code

[Code] .........

View 3 Replies View Related

Find Value Matching Multiple Text Criteria And Max Date

Jun 7, 2009

I have the following dataset:

[Date] [Category] [Currency] [ExchangeRate] [.....], etc.
1-3-09 A USD 0,8
1-6-09 A EUR 1
1-7-09 A USD 0,7
1-8-09 B USD 0,9
1-9-09 B USD <formula>

I'd like to have the value of <formula> looked up in older records. Currency and category should match and it should pick the exchange rate with the maximum date.

Which formula and what syntax should I use to have this done?

I use Excel 2007.

View 10 Replies View Related

VBA - Advanced Filter / Find Row Items To Remove Based On Multiple Criteria

Jun 28, 2014

I'm working with many rows of data (500,000+) and many columns. To simplify my question, I'm going to provide a simple example using made up numbers and only the columns I'm concerned with.

BillT Doc.ItemQty

I am trying to remove the docs that have two Bill types that cancel each other out, where the qtys match and highlight the rows where the qtys don't match. The macro needs to have the positive and negative bill types programatically entered, where for example F1 and F2 are positive and S1 and RE are negative. Keep in mind the data may not necessarily be in order as it is above.

So for example with data above, the rows for doc 777 would be removed completely because the item numbers are the same, the qty is the same, and the bill types oppose each other. Doc 123 and Item 10 lines should be highlighted since their bill types are opposed bu their qtys don't match.

I hope this makes sense. I tired to achieve this using multiple loops and arrays, but ran out of memory when working with the entire set of data. I'm assuming their must be a better way to do this, I'm hoping some of the intelligent individuals here will be able to point in the right direction.

View 8 Replies View Related

Generalizing Search Criteria In Macro Code

Mar 24, 2014

HTML Code: 

Sub CopyTimeColumn()
Dim tFIND As Range

On Error Resume Next
With ActiveSheet
Set tFIND = .Range("1:10").Find("Time", LookIn:=xlValues, LookAt:=xlWhole)
If tFIND Is Nothing Then

[Code] ............

This code searches the "Time" Column in first ten rows and copies it to another sheet...

If I have encountered with such a column whose title is "Time in seconds" then it will not search this column...What i want is the modification of this code such that it can detect column which contains any part of "Time" word in it ...

View 3 Replies View Related

Macro To Find Criteria And Copy To Next Page

Feb 10, 2014

I am in need of a macro that will:

1. Check cell B1 for my named regions
2. Find all citys in that region from another worksheet
3. Copy the specific details
4. Highlight the information that has just been copied and create a bar chart for comparison

Data to be picked up from "Inc 8%" sheet.

Headings are the same on both the worksheet the information is being taken from and being pasted to.

I need City, Year 1 Turnover - Year 10 Turnover data to be copied.

Region Help.xlsm

View 2 Replies View Related

Macro: Find The Code

Jan 15, 2009

i need a macro that will look in column B and find the following rec codes, if found then keep these codes else delete (Entire row) for all other rec codes in this column,


View 9 Replies View Related

Macro Code To Find The Maximum Value

Jul 15, 2009

I would like to run a macro loop to find Maximum value out of these three column and return text into a cell as "maximum value found = A" or B ....

View 12 Replies View Related

VBA Code To Script A Macro To Use The Find Box

Jun 21, 2007

I need some VBA code to instruct a macro to use the text entered in the find box.

View 9 Replies View Related

Multiple Options Cell Values Based On Multiple Criteria Variable Inputs?

Mar 18, 2013

I maintain the data flow at my work. We send and receive the data using excel files with specific formatting that I then upload to the database. Each time I send or receive the excel file I must log them, this is what my code question refers to.

I use RDBMerge to merge all the contents of the 100 plus excel files into one worksheet. The first part of the macro cleans up the merge data for use in the log (i have attached an example of the clean data and finished log).

The blue shaded area of the "Raw_Data" is what the clean data looks like, the yellow column is what current macro records for each record.

As you can see by the example the Raw_Data is only two files LL_LLL_BOB_ToLLLLL_20121228_01 & LL_LLL_BOB_ToLLLLL_20121230_01, each with more that one record.

The log code in column "H" Is based on this criteria:
First Letter of the Unique ID in column "E" - O, M, or L
Program Type in Column "F" - U or R
1. O-U = U
2. O-R = RU
3. M-U = U2
4. M-R = R2U
5. L-R = R

You will note that Columns G-R of the "Log Sheet" correspond to the "Record Type" found in Column "G" of the "Raw_Data" sheet.

This is the area where my skill at using scripting dictionaries fails.

The results for the log list each file only once, but the log code for each corresponding "Record Type" in columns G-R of the "Log Sheet" must contain each unique instance of the code. In other words

if LL_LLL_BOB_ToLLLLL_20121228_01 contains an O-U with an "A" Record Type and an M-R with an "A" Record Type; then, on the log sheet there needs to be the codes "U/R2U" in the cell intersection of the LL_LLL_BOB_ToLLLLL_20121228_01 record row and "A" column (which is column "G")

So, If the File contains one of each code for each Record Type the corresponding cell must house one of each code separated by a "/" without any spaces. This means the cell value could no code, or one code and all the variations in between to all five codes. Also, for ease of human reading the log codes should be concatenated in the 1-5 order that I listed them in (U/RU/U2/R2U/R)

Here is my code so far.

Option Explicit
Sub test()
Dim dic As Object, a, i As Long, rng As Range, e, w, n As Long
Set dic = CreateObject("Scripting.Dictionary")


View 1 Replies View Related

Pull Data From Multiple Cells And Concatenate In Single Cell Using Multiple Criteria

Aug 31, 2012

I have a worksheet entitled 'Data'. In this worksheet there is a table consisting of 4 columns plus relevant data:


Benefit Type
Delivered or Enabled

Saving of $4M over 24 months.


I have been trying to create a formula that will enable me to pull data from the 'benefit' column(column D) so that the cell contents populate in a single cell in a table in a different worksheet.


Financial - Delivered
Financial - Enabled
Tech - Delivered
Tech - Enabled
Green - Delivered
Green - Enabled


So, as an example, I am hoping that a formula can be created which pulls the text from relevant cells in column D when criteria from columns A, B and C are met e.g. Tech benefits that are Delivered in PJ2 would populate cell E3 ('Tech -Enabled') in Table 2 with:

Continued maintenance of hardware.

Increased capacity.

View 1 Replies View Related

Return Multiple Results In Multiple Cells Based On Criteria In Yet Another Cell?

Feb 1, 2012

Worksheet 1: In column A I have a people's initials. In coumn B I have text boxes with miscellaneous text. (The same person could have multiple rows within this sheet.)

AAA blue
BBB orange
AAA round
CCC smelly
AAA elongated

Worksheet 2 I want to show:
A2 = initials, B2 = first text box associated with that person, C2 = second text box (different row) associated with that person (if applicable), D2 = third text box (different row) associated with that person (if applicable), etc.

AAA blue round elongated
BBB orange
CCC smelly

View 3 Replies View Related

Search Multiple Criteria If Match Append Multiple Cells To One Cell?

Apr 28, 2012

I am having such a difficult time creating a macro that will reduce the 5+hours I have to spend each week manually copying & pasting all of this data. I making an IMMENSE difference in this worker bee's life!

I have a workbook with two sheets (Sheet1 & Sheet2). Sheet1 has license #'s in column A and the state that the license belongs to in column B like this:

COLUMN ACOLUMN B11111Alaska11112Alabama11113Arkansas11114Arkansas
Sheet2 has three columns. Column A has the license #'s, column B has the state that the license belongs to and Columns C shows a line-of-authority tied to that license #.


I'm trying to write a macro that will compare the license # and state in Sheet1 to the license # and state in Sheet2. If it matches, append the contents of Column C to the corresponding row in Sheet1.

Here's the thing...Sheet2 contains the entries for all licenses in the company (so this table is HUGE). And there are multiple entries for each state license # (notice how there's two entries above for AK license # 11111 - one for the Property line and one for the Casualty line.

After my macro is run, I want Sheet1 to show all the lines-of-authority on a single line. So if I ran my macro on the above example, after it's run I would have this in Sheet1:

C11111AlaskaProperty Casualty11112AlabamaProperty Casualty11113
ArkansasLife Health11114ArkansasLife Health

View 5 Replies View Related

Find And Replace Macro - Modifying Code In Engagement

Jan 27, 2014

I am trying to make a find and replace macro for multiple items.

Please see the attached file for further explanation : macro.xls‎

View 3 Replies View Related

Macro Code To Find / Insert And Fill Text?

Oct 11, 2011

I need a macro script that goes to a particular cell in a column based on a criteria (say, locate the first instance where $0.21 appears in col. H), insert a row above it, and fill the row with the text "Note:These are above $0.20"

View 2 Replies View Related

Copyrights 2005-15, All rights reserved