All you need to do is alter the code you were given to include the following :

Code:
If TypeName(Controls(iNum)) <> "CommandButton" Then
  <Do the things you need to do>
End If
Obviously replacing iNum with the variable you had before