Programming A Search Function
Jul 30, 2008how to type a name into one cell and have all the places in a particular range (a1:H12) that displays that name to highlight a color.
View 14 Replieshow to type a name into one cell and have all the places in a particular range (a1:H12) that displays that name to highlight a color.
View 14 RepliesI have an excel sheet which has 5 columns & 5 rows.I would like to transpose values in 3rd column to 5th column .But after running my code I am not being able to get the deired output. rectify the error for me?
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)
xlSheet. Cells(1, 1) = "NAME"
xlSheet.Cells(1, 2) = "CITY"
xlSheet.Cells(1, 3) = "STATE
xlSheet.Cells(1, 4) = "ADDRESS"
xlSheet.Cells(1, 5) = "PINCODE"
Using the search macro code below, could someone please help to add in more codes what I'm currently using, and also where to insert it. The Search function works well for what I need and it helps me to locate data. When using the search function somehow it search all sheets within the workbook but I only want it to search an array of sheets when using this macro that is needed to complete the task for what I'm after.
Macro
Public Sub FindText()
'Run from standard module, like: Module1.
Dim ws As Worksheet, Found As Range, rngNm As String
Dim myText As String, FirstAddress As String, thisLoc As String
Dim AddressStr As String, foundNum As Integer
myText = InputBox("Enter the text that you want to search for:", "Start Search!")
If myText = "" Then Exit Sub...................
I'm from Bavaria, Germany. Right now, I am doing an internship for my studies. my problem: I need a search procedure which shows an Input Box where you can enter a word to search for. It should work like the original Excel search (Ctrl-F), but with a simpler design, like with my own Text "Enter your Query" and a Button "Submit Query" / "Quit search". Is there the possibility to Highlight the Search Target? The problem hereby is that this highlighting should not be permanent. That means the user sees the target for which he searched for, the cell highlighted in a different color, etc. But as soon as the user clicks onto another cell, etc., the highlighting vanishes. If there is no fitting match, there should be a MessageBox like "Sorry the Target xyz cannot be found"
View 9 Replies View RelatedI' having trouble using the =IF(ISNUMBER(SEARCH formula to search multiple cells.
I can get it to work to search one cell (as below):
=IF(ISNUMBER(SEARCH("Same",G10)),"No Change",'Aug 09 Matrix'!F10)
(In this case the respone is No Change as Cell G10 contains "Same")
However cannot get it to work for several cells. I have pasted below and highlighted the function I would like it to perform:
=IF(ISNUMBER(SEARCH("Same",G10:R10)),"No Change",'Aug 09 Matrix'!F10)
Essentially the other cells in that row (G10:R10) all contain "Same", however for some reason it is identifying this as FALSE and putting in the data from the 'Aug 09 Matrix' sheet.
I have an 'Update' Module that search the value of the Userform1.txt_sc.Value in Column B, but I want to search to 2 criteria, how can i amend the below code to search for 2 criteria ( userform1.txt_sc.value & userform1.txt_linenum.value )
View 2 Replies View RelatedThis may be a bit of a silly question but any assistance would be much appreciated, as I cannot figure out where I am going wrong:
Dim RRR As Range
Set RRR = Range("c3").End(xlDown).Select
What I am trying to do is to create a dynamic range called 'RRR' so that everytime the macro is run, it makes sure that all the data is selected in the column.
I have attached a worksheet as my example.
I have been trying to build code and I am a newbie when it comes to this.
I have a sheet that is user entered (Criteria). I need to build a macro/code that says if they choose "Yes" to any of the Products on the criteria sheet, then copy all rows that have an X in them that are in the corresponding column on the Master Template. To make it even more complicated I only want to copy 4 of the columns (ID, Task, Share with Client and Accountable).
I know if they choose multiple columns then I could have duplicate rows, but once all the rows are copied I was going to build a remove duplicates macro. However, if there is anyway of preventing duplicates with the original.
I need help to get the macros right to do the following that it can not do now:
I would like the user to be able to pause in between input areas and do others things.
Need for the input length to be varible or grow with the information
Are these things possible?
I have only the basic knowledge of the VBA programming. Are there any books you can recommend?
View 2 Replies View RelatedI am looking for a code to generate a combinations of x numbers taken 5 at the time. t
View 2 Replies View Relatedi could create a spreadsheet with two columns one with email addresses and another with a path to an attachment
e.g. column a = example@example.co.uk
column b = c: est.xls
and then for a macro to read my data, and send an email to those email addresses in column a with the attachment of column b
I have created a userform with text boxes and a list box. I have a few questions. First for the list box. I got the information for my list box through the list box example sheet2!A1:A1000. Is there any easier way ? Next I would like to create a New Command button to create a new record. I decided to just do a clear all textboxes, option buttons ect.. to clear, is there an easier way ? I seem to be looping sort of way when I get to txtissue.Value = "" it than goes to txtIssue_Change()
View 14 Replies View RelatedI have a base list of numbers on a spreadsheet that represent specific values. For example, Column A has a list from cell 1 to 20 that contains a group of different numbers that all represent credits. Column B also has a list with different groups of numbers that represent debits. Each month I receive a report with a large list of numbers that contain credits and debits. I sort the list and use my base list as a reference to differentiate what groups of numbers are debits and which ones are credits.
I am hoping there is an easier way to do this. My question is, is it possible to use the base list that I have as a template so that the next time I receive a report, I can just copy and paste the numbers onto the template and have them somehow formatted or programmed to reflect their correct code of either debit or credit?
I need to compare dates in excel (VBA programming). How can I do to Compare two dates. If I wanna know the difference between to dates (days, moths and years)
View 2 Replies View RelatedAttached is my worksheet. I need to program column C to adjust the value in column A according to the rules set in table J2:K17, but ONLY if the value in column B = mens. If the value in B does not equal mens, then leave the C cell blank. I've manually populated column C to show the end result that I'm looking for.
I tried a simple =IF(ISNUMBER(SEARCH("Small",A2)),"S",""), etc., but I can't figure out how to incorporate the additional condition that would let the cell return a value ONLY when a condition in B is also met.
NBVC helped me with a similar request previously, but with that formula, if the condition wasn't met, the cell returned "#N/A" instead of being blank.
I been trying to create stuff that will make my work life real easy. I need creating a program that will send an email to different recipients. I created a spreadsheet the contains different information. When a persons name is selected on Column D, excel/outlook will generate an email to that person containing the info on Column A to D.
And then as soon as the work is processed and column G is filled, outlook will generate an email back to who created the requests column A.
I have some code below which looks at values added between a set range of cells. This works OK.
My problem is when i have to change the cell as it removes the background colour already set to certain columns ie Columns I, J, P, Q, W, X, AD, AE (these are coloured a light green).
The other cells in the range have no colour and so the code below works with no problem.
I'm trying to move my VBA programming to the next level and use more efficient code.
I'm wondering if there is a faster way to run the loop below, perhaps removing the 'For c = 2 to LastRow' as it seems a little clunky to me.
For c = 2 to LastRow
If Cells(c, Range("Product_Type").Column) = "" Then _
Cells(c, Range("Product_Type").Column).Interior.ColorIndex = 41
Next c
I've seen a similar thing somewhere where it was all done in one statement without the loop.
I'm building a macro thats copying 4 rows of data at a time from a spreadsheet (has 1500 rows of data total) and transposing it to a master spread sheet. There are blank rows in between each entry (the data source I'm using isn't clean), so how can I either have the macro jump to the first row it finds with a value, copy rows until it stops finding a value, paste+transpose into a new document and then repeat the process throughout the document.
If thats too complicated, a macro that finds rows based on a formula would work as well. E.g. Start at row 5, copy+paste+transpose 5-8, start at row 11 (5+6), copy + paste+transpose 11-14, start at row 17 (x+6) ...etc... Here's the code I have developed thus far:
I'm trying to set up a way to format column widths and row heights in a macro (so that it can read a value from a cell and format a column to that width). I've used the code below which can be repeated for the number of rows and columns desired below
Worksheets("Sheet1").Range("d1").ColumnWidth = Range("d1")
However, I want to be able to do this on a workbook that could potentially have 40+ sheets. Is there a way of applying this code to operate over the whole workbook rather than just one sheet at a time?
I would like to use the search function in vba to look for a 5 digit number in sheet1(at a specific cell) from a list in sheet2- ie the range. Am I using the range correctly? This code is in a command button in sheet1.
Dim Z As Integer
On Error Resume Next
Z = Application.WorksheetFunction.Search(111, Worksheets("Sheet2").Range("a1:a100").Value, 1)
[Code].....
I need to create a function that searchs one definitive word or phrase inside of a text in the Excel and creates a vector with the address of the cells that contains it.
Inside of this function, to create the option to change the color of the source or the color of deep, or to erase the indicated cells
Function SearchValue(SearchedValue As String, Interval As Range)
Dim Célula As Range
For Each Célula In Interval
If InStr(1, UCase(Célula.Value), UCase(SearchedValue)) 0 Then
If IsEmpty(SearchValue) Then
SearchValue = Célula.Address
Else
SearchValue= SearchValue & ";" & Célula.Address
End If
End If
Next Célula
End Function
Can you use the Search function in VB? If so what's the code? Do you have to call it first ( Call Search .....)
View 2 Replies View RelatedI am trying to workout a formula to look-up and categorize data from a bank statement, without having to complete manually monthly.
So far I have a formula that returns the amount spent, but would need an extra column and separate table for each category.
IF(OR(ISNUMBER(SEARCH(" "&$G$3:$G$11&" "," "&A2&" "))),B2,0) where
Instead of returning B2, I would like to return a value from the table in column H3:H11 that corresponds with G2:G11, as shown below.
ColumnG ColumnH
Aldi Food
woolworths Food
Coles Food
saint Nicholas School
Blooms Medicines, toiletries, hairdressing, personal items
vodafone telephone
So for example if Aldi is in the text in A2, then I would like to return food ( from a lookup table similar to above) into the column where my formulae is ( say F2).
I have recorded the below code, is it possible to adjust this so that instead of using "USD" the macro will reference whatever currency the user inputs into say sheet1 cell A1?
View 2 Replies View RelatedHow I could create a search function with this document attached. I want to be able to pull the kids name, location & information over to a search engine when looking for them because I will have over 40 different worksheets with numerous names on each of them.
View 5 Replies View RelatedI'm having trouble finding the correct way to use this formula. Basically, I need the formula to populate what is in another cell, minus any apostrophe's ( ' ) that are in the text. Sometimes the text contains the apostrophe and other times it does not. I just want whatever text is in the cell to populate, whether it contains an apostrophe or not.
Here is what I've been using so far, but it only produces a value if there is an apostrophe. If there isn't an apostrophe in the text, nothing populates.
=RIGHT(Input!G2,LEN(Input!G2)-SEARCH("'",Input!G2))
I would like to search a cell and look for a certain value in it, and if it is, for there to be an X placed in another cell. Column A has the values, I would like to put the function into column B, and the X to appear in column C. I will attach a spreadsheet if it is needed, for this particular function, I will say we are searching for PP in the cell
View 2 Replies View RelatedI have 6 worksheets with data. Column C of every worksheet is filled with unique Tracking Numbers.
I want to create a 7th worksheet with a search function. Users will be able to type in a Tracking Number (on cell A2), and information associated with that Tracking Number (from Columns A, D, E, F and G of worksheets 1-6) will show up beneath cell A2 on cells A4, B4, C4, D4, and E4.