That's probably because it's not written correctly. Try:
This will delete line 2 of code in Sheet1's code module. By leaving off the second argument (# of lines) it defaults to 1 line. If you specify .CountOfLines, but your starting line is greater than 1, you'll get an error since the code cannot delete 50 lines of code if only 50 exist and you start at line 2. (In that instance, you could use something like
If you want to be able to see the properties and methods of the VBProject or VBComponent objects, set a reference to 'VBA for Applications' in Tools -> References (in the VB Editor window).
Bookmarks