As others have suggested, you would just add some more criteria inside
the "For i = 0 to ubound(array())" loop. For example
If instr(1, cell, "*[1234567890]*") then
msgbox "error"
end if
Sorry I didn't test this code but hopefully you get the idea.
HTH,
JP
On Nov 11, 9:36 am, "MiM" wrote:
Uzytkownik "JP" napisal w wiadomoscinews:1194788390.259700.78250@19g2000hsx. googlegroups.com...
How about something like this? Select your cells first, then run. It's
a simple loop to check a list of cells against a list of reserved
words.
Sub CheckFunctionNameError()
Dim cell as Range
myArray = Array("cells","range","function","end","call","run ")
For each cell in selection
For i = 0 to ubound(array())
If cell = array(i) then
msgbox "One of your cells is using a reserved
word!",vbcritical
End if
Next i
Next cell
End Sub
This is air code, I did not test it. Just add the reserved words to
the Array(), I only added the ones I could think of off the top.
HTH,
JP
Yes, but this is only one check if a cell contents is a reserved word. I
must check if it follows VB naming rules.
Maybe my English is so poor, but this is not what I want.
Once again
I have some cells in worksheet, and I want to create a module with some
macros named like these cells contents.
So, for example I have in column data like this:
AAAA
bbbb
12a
aaa and bbb
cccc
Now I must to create 5 macros with the names determined by cells contents so
I must check if they follow visual basic naming rules. In this example only
first, second and last cell can be a valid function identifier. How can I
check this?- Hide quoted text -
- Show quoted text -