How To Use InStr

Nov 15, 2006

I have a column with this info: US,ULS,ULT.

When i have US or ULS or ULT alone in the column the macro is working perfect
But when i have US,ULS together my macro is pulling the information from US.... and is not using the comand .......ElseIf ((InStr(series, "US") 0) And (InStr(series, "ULS") 0)) Then

If (InStr(series, "US") 0) Then
Call HOME
div = "2"
cntr = "Sold"

ElseIf (InStr(series, "ULS") 0) Then
Call Univer
div = "12"
cntr = "House"

ElseIf (InStr(series, "ULT") 0) Then
Call masters
div = "Pi"
cntr = "Down"

ElseIf ((InStr(series, "US") 0) And (InStr(series, "ULS") 0)) Then
Call Univer
div = "24"
cntr = "twin"

End if

View 9 Replies


ADVERTISEMENT

Right INSTR

Oct 29, 2009

I have some text in column A.

I need to find where the last letter "R" is in that text.

Sort of like =FIND("R",A2), but I need it to go from the right side of the text instead of the left side.

Example:
R123R45R78 would return 3.

There may be any number of R's in the text. I can't predict that.

View 9 Replies View Related

Using InSTR Function In VBA

Feb 4, 2013

I have an unsorted list of countries in column B, as below.

UK
USA
UK
Germany
UK
USA
Spain
France
Spain

how to use VBA and INSTR function to read that list and create a distinct list of these and write them somewhere

so the resulting list would be:

UK
USA
Germany
Spain
France

View 9 Replies View Related

InStr Function That Uses Various Characters As 1

Apr 14, 2014

I am trying to write a function that recalculates given times to points (as used in speedskating).

The times are filled in by a number of people, which each use their own method of dividing minutes from seconds (and 1/100 of a sec).

I found out how to see the difference between times that look like 1.11.11 and 11.11 etc

How to use that same method in an InStr function. Most of the times I get an error message #Value or something that has that format, sometimes all I get is a 0.

View 14 Replies View Related

Changing VBA Macro Using InStr?

Aug 29, 2012

I want a vba macro which performs some thing like this. I think probably this can be done by using InStr function, the macro attached here just find the exact same value and shows the result but i want similar values,

Code:
Sub a()
lastrow = 10
For arow = 11 To 16

[Code].....

View 7 Replies View Related

Instr Function Returns Zero

Jun 25, 2007

i have a very basic function using instr as follows:

ins = 0
Dim x As Integer
Dim y As Integer

findst = "["
finden = "]"

x = InStr(ins, oldstrgFd, findst, vbTextCompare)
y = InStr(ins, oldstrgFd, finden, vbTextCompare)

Debug.Print x,y

oldstrgFd in the example is populated with

[ClientName] Planning Workshop
[FeedbackLocation], [FeedbackDate]
[FeedbackPresenters]

I am expecting this the first positions of the square brackets, but x and y both return 0.

View 3 Replies View Related

Change Macro Using InStr Function

Aug 30, 2012

I want to change my existing macro using InStr function in such a way that when the columns are found then it add the corresponding values. The addition of values have already been done. I just want that if similar values are found then it show the results.

The example workbook with macro is attached : comparestrings.xls

View 1 Replies View Related

Using InStr Function In Case Statement

Sep 9, 2012

I am attempting to use the following code to move certain sheets to specific locations in my workbook. The case statement containing the InStr function isn't working eventhough the "Data" tab does exist and the InStr function does return 1.

Code:
ThisSheetToMove = Sheets(SCount).Name
Select Case ThisSheetToMove
Case "Schedule"
Sheets("Schedule").Move Before:=Sheets(1)
Case InStr(1, Trim(ThisSheetToMove), "Data") > 0
Sheets(ThisSheetToMove).Move After:=Sheets(SShtLast)
End Select

View 4 Replies View Related

2003/2007 Problem With InStr, Replace, And Len

Feb 22, 2009

I have run into a brick wall with InStr, Replace, and Len. I take the data from the active cell (formatted as text). I need to cleanup the data and do further massaging of it. In testing cleanup code, I get behavoirs and results I simply don't understand and can't figure out from hours searching forums many places.

The following simplified example commented code can be cut/pasted into a new spreadsheet module and should be self-explanatory. Example data is in the comments. Data is entered by multiple users and multiple sources. Therefore there is no control over the input quality so extraneous characters and multiple repeated periods and spaces can show up anywhere.

View 4 Replies View Related

Return Word In A Cell To The Cell In Next Column - InStr Not Working

Jan 27, 2014

I am trying to write a sub for using vlookup. To enable the vlookup, I want to return a word in a cell to the cell in the next column. I use the InStr function, but it doesn't work. They all return as "Other".

Attached is the worksheet and here are the codes : Capture.JPG

[Code] .....

View 11 Replies View Related

Using InStr To Find Number Within A Number?

Jun 6, 2006

I work for a store and we're migrating to a new Point of Sale system. The new POS uses the entire UPC code while our existing one uses only partial UPCs, so I have to update from the partial to the full. ex. Partial 3378093 - Full 0033780935

The partial UPC will always be included in the full UPC, the difference is the dropped leading zeros (and possibly other numbers) and the check digit number at the end. What I have is a spreadsheet with with two worksheets (Old, New) - one has our old UPCs and other information, the other has the new, full UPCs and more information we'll need. What I want to do is write a function that will search through the full list of new UPCs to find the one with the old UPC inside it and return the full UPC. InStr seems the right function to do this - correct?

The part I'm having trouble with is writing something that will search through the full column of new UPCs using InStr. I've searched through the forum for a similar situation but the few I've found aren't working or appropriate. I don't want to include any code I've written because 1) it doesn't work and 2) it would be way too embarassing!

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved