View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default increment operator?

eg something like :
Inc(long.variable.name)


Excel vba doesn't have the ++n operator as in some other programs.
Another option similar to Jim's but without parenthesis might be:

Function Inc(ByRef n)
'// Increment by +1
n = n + 1
End Function

Sub Example()
Dim long_variable_name
long_variable_name = 10

Inc long_variable_name
End Sub

--
HTH :)
Dana DeLouis
Windows XP & Office 2003


"Peter Morris" <nospam.ple@se wrote in message
. uk...
Is there a shorthand increment operator ?

eg something like :
Inc(long.variable.name)

which would be easier to read than
long.variable.name = long.variable.name + 1



Also decrement too.