Excel VBA Macro: User Defined Type Not Defined

Your error is caused by these: These types, Table and Row are not variable types native to Excel. You can resolve this in one of two ways: I have not tested your code but I suspect ActiveDocument won’t work in Excel with method #2, unless you properly scope it to an instance of a Word.Application object. I don’t see that anywhere … Read more

VBA, if a string contains a certain letter

Try using the InStr function which returns the index in the string at which the character was found. If InStr returns 0, the string was not found. InStr MSDN Website For the error on the line assigning to newStr, convert oldStr.IndexOf to that InStr function also.

Does VBA have Dictionary Structure?

Yes. Set a reference to MS Scripting runtime (‘Microsoft Scripting Runtime’). As per @regjo’s comment, go to Tools->References and tick the box for ‘Microsoft Scripting Runtime’. Create a dictionary instance using the code below: or Example of use: Don’t forget to set the dictionary to Nothing when you have finished using it.

Check if a string contains another string

Use the Instr function 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 … Read more

How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops

1066 Regular expressions are used for Pattern Matching. To use in Excel follow these steps: Step 1: Add VBA reference to “Microsoft VBScript Regular Expressions 5.5” Select “Developer” tab (I don’t have this tab what do I do?) Select “Visual Basic” icon from ‘Code’ ribbon section In “Microsoft Visual Basic for Applications” window select “Tools” from … Read more