![]() |
Incrementing a variable by 1
Apologies for the simple question, but I can't find the answer by
searching the net. In PHP you can increment a variable by 1 thus: $var++; In some forms of BASIC it's: var +=1 How do you incremenet a variable by 1 in VBA other than: iVar = iVar + 1 Is there simpler way? Thanks. |
Incrementing a variable by 1
Hi Sskulkrinbait,
The normal method would be that shown by you: iVar = iVar + 1 --- Regards, Norman wrote in message oups.com... Apologies for the simple question, but I can't find the answer by searching the net. In PHP you can increment a variable by 1 thus: $var++; In some forms of BASIC it's: var +=1 How do you incremenet a variable by 1 in VBA other than: iVar = iVar + 1 Is there simpler way? Thanks. |
Incrementing a variable by 1
iVar = iVar + 1 doesn't seem particularly onerous to me but another way is a
For - Next loop where the variable is increased by 1 when the next is executed. " wrote: Apologies for the simple question, but I can't find the answer by searching the net. In PHP you can increment a variable by 1 thus: $var++; In some forms of BASIC it's: var +=1 How do you incremenet a variable by 1 in VBA other than: iVar = iVar + 1 Is there simpler way? Thanks. |
Incrementing a variable by 1
On Apr 27, 10:10 am, Mike H wrote:
iVar = iVar + 1 doesn't seem particularly onerous to me but another way is a For - Next loop where the variable is increased by 1 when the next is executed. " wrote: Apologies for the simple question, but I can't find the answer by searching the net. In PHP you can increment a variable by 1 thus: $var++; In some forms of BASIC it's: var +=1 How do you incremenet a variable by 1 in VBA other than: iVar = iVar + 1 Is there simpler way? Thanks.- Hide quoted text - - Show quoted text - Thanks, I was wondering as some of my variable names are quite long so if you could do it using var ++ or something it would save me a second or two each time, I must be getting lazy. |
Incrementing a variable by 1
Hi Sskulkrinbait,
'----------------- Thanks, I was wondering as some of my variable names are quite long so if you could do it using var ++ or something it would save me a second or two each time, I must be getting lazy. '----------------- You could autocomplete the long variable name using Ctrl_Shift ... --- Regards, Norman |
Incrementing a variable by 1
Hi Ruben,
It is not Ctrl+Shift The Autocomplete Word option is Ctrl+Space Indeed! I intended Spacebar but somehow wrote Shift! Thankyou for the correction. --- Regards, Norman |
Incrementing a variable by 1
I was wondering as some of my variable names are quite long so
Hi. This is in my Library of routines. I shortened the name to "Inc" to represent the "Increment" function. Function Inc(ByRef n) '// Increment by +1 n = n + 1 End Function Sub Test() Dim ALongVariableName ALongVariableName = 6 Inc ALongVariableName End Sub -- HTH :) Dana DeLouis Windows XP & Office 2007 wrote in message ups.com... On Apr 27, 10:10 am, Mike H wrote: iVar = iVar + 1 doesn't seem particularly onerous to me but another way is a For - Next loop where the variable is increased by 1 when the next is executed. " wrote: Apologies for the simple question, but I can't find the answer by searching the net. In PHP you can increment a variable by 1 thus: $var++; In some forms of BASIC it's: var +=1 How do you incremenet a variable by 1 in VBA other than: iVar = iVar + 1 Is there simpler way? Thanks.- Hide quoted text - - Show quoted text - Thanks, I was wondering as some of my variable names are quite long so if you could do it using var ++ or something it would save me a second or two each time, I must be getting lazy. |
All times are GMT +1. The time now is 05:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com