![]() |
increment operator?
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. |
increment operator?
You could create one...
lngNum = AddOne(lngNum) Function AddOne(ByVal lngN As Long) As Long AddOne = lngN + 1 End Function -or- Call AddOne(lngNum) Function AddOne(ByRef lngN As Long) lngN = lngN + 1 End Function ----------- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Peter Morris" <nospam.ple@se wrote in message 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. |
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. |
All times are GMT +1. The time now is 12:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com