Use the Instr function
Dim pos As Integer pos = InStr("find the comma, in the string", ",")
will return 15 in pos
If not found it will return 0
If you need to find the comma with an excel formula you can use the =FIND(",";A1)
function.
Notice that if you want to use Instr
to find the position of a string case-insensitive use the third parameter of Instr and give it the const vbTextCompare
(or just 1 for die-hards).
Dim posOf_A As Integer posOf_A = InStr(1, "find the comma, in the string", "A", vbTextCompare)
will give you a value of 14.
Note that you have to specify the start position in this case as stated in the specification I linked: The start argument is required if compare is specified.
Related Posts:
- What does <> mean?
- How to find a value in an excel column by vba code Cells.Find
- VBScript to open a dialog to select a filepath
- Does VBA have Dictionary Structure?
- “Sub or Function not defined” when trying to run a VBA script in Outlook
- What is the function of FormulaR1C1?
- What exactly is the function of Application.CutCopyMode property in Excel
- VBA Excel – Insert row below with same format including borders and frames
- Deleting a file in VBA
- Excel VBA: Can’t get a match, error “Unable to get the Match property of the WorksheetFunction class”
- How to comment and uncomment blocks of code in the Office VBA Editor
- Run-time error ‘3061’. Too few parameters. Expected 1. (Access 2007)
- Pass arguments to Constructor in VBA
- How to install Date Picker form control in Excel 2016
- How to install Date Picker form control in Excel 2016
- How to fill color in a cell in VBA?
- Refreshing all the pivot tables in my excel workbook with a macro
- VBA: Run time error ’91’?
- Compare Dates in VBA
- What is the difference between “Form Controls” and “ActiveX Control” in Excel 2010?
- ‘Cannot find DAO350.dll’ file error VB6
- Average in VBA in Excel
- VBA Excel “Compile error: Object Required”
- Choosing paper size (NOT DEFAULT sizes) in excel vba
- “Unable to get the VLookup property of the WorksheetFunction Class” error [duplicate]
- Paste Special error 1004 PasteSpecial method of Range class failed
- VBA: Getting run-time 1004: Method ‘Range’ of object ‘_Worksheet’ failed when using cells
- Cannot run the macro… the macro may not be available in this workbook
- How do I lowercase a string in Python?
- Why the switch statement cannot be applied on strings?
- How does strtok() split the string into tokens in C?
- How to read a file line-by-line into a list?
- How to convert string to char array in C++?
- How can I convert a std::string to int?
- Check if a string has a certain piece of text [duplicate]
- How can I convert String to Int?
- How to convert a string to an integer in JavaScript?
- How to convert string to char array in C++?
- How to convert an int to string in C?
- C++ string to double conversion
- How do I make the first letter of a string uppercase in JavaScript?
- Regex not operator
- Reverse a string in Java
- Best way to convert string to bytes in Python 3?
- How to check if a String contains another String in a case insensitive manner in Java?
- Split string into array
- How to replace � in a string
- How to print like printf in Python3?
- Convert int to string?
- Multi-line string with extra space (preserved indentation)
- How to find all occurrences of a substring?
- How to reverse an std::string? [duplicate]
- How to split a delimited string into an array in awk?
- What is the difference between a “line feed” and a “carriage return”?
- How to convert an int to string in C?
- Check string “None” or “not” in Python 2.7
- What’s the best way to convert a number to a string in JavaScript?
- How to replace all double quotes to single quotes using jquery?
- How to split a string in Java
- How to convert a std::string to const char* or char*
- Regex how to match an optional character
- Left Hand Side of an Assignment must be a Variable CharAt
- How to get the filename without the extension from a path in Python?
- How do I apply the for-each loop to every character in a String?
- Parsing a comma-delimited std::string
- Java – removing first character of a string
- Explain the use of a bit vector for determining if all characters are unique
- How can I remove punctuation from input text in Java?
- Sort a single String in Java
- Convert a String In C++ To Upper Case
- What is Java String interning?
- Right way to split an std::string into a vector
- How to remove text from a string?
- PHP: variables in strings without concatenation
- Select method of Range class failed via VBA
- How to sort an array of objects in Java?
- C++ Simple hangman game
- Remove First and Last Character C++
- How to compress a String in Java?
- C++ Convert string (or char*) to wstring (or wchar_t*)
- Java end of file
- Unclosed Character Literal error
- Add String Array to ArrayList
- StringIndexOutOfBoundsException String index out of range: 0
- Trying to use int in getline
- Difference between String replace() and replaceAll()
- How does str(list) work?
- Does C have a string type?
- Check if URL has certain string with PHP
- How to do std::string indexof in C++ that returns index of matching string?
- variable or field declared void
- Insert a string at a specific index
- Extract filename and extension in Bash
- Meaning of #{ } in Ruby?
- realloc(): invalid next size when reallocating to make space for strcat on char *
- Why cannot cast Integer to String in java?
- Why are there two different getline() functions (if indeed there are)?
- Convert an array to string
- Why does my program give “NULL used in arithmetic”
- In Java, how do I parse XML as a String instead of a file?