![]() |
Set Multiple Variables
Hi,
If I have Dim'd a bunch of string variables, is it possible to set them all to the same value in a single line? Eg. Dim sText1 Dim sText2 sText1, sText2 = "" 'this doesn't work! I actually have about 20 of these variables that I want to set to blank before working with them, and having the same line 20 times seems to be rather inefficient. This is in Office 2003, if that makes a difference. TIA Dave |
Set Multiple Variables
Hi,
You can't reset a group of individual variables in one go, it would have to be done one at a time. Mike "Risky Dave" wrote: Hi, If I have Dim'd a bunch of string variables, is it possible to set them all to the same value in a single line? Eg. Dim sText1 Dim sText2 sText1, sText2 = "" 'this doesn't work! I actually have about 20 of these variables that I want to set to blank before working with them, and having the same line 20 times seems to be rather inefficient. This is in Office 2003, if that makes a difference. TIA Dave |
Set Multiple Variables
You can dim multiple variables on one line
Dim sText1 as String, sText2 as String or why not consider using an array e.g Dim sText(1 To 20) As String You can then set and read each by reference the array index sText(1) = "My Value" -- Regards, Nigel "Risky Dave" wrote in message ... Hi, If I have Dim'd a bunch of string variables, is it possible to set them all to the same value in a single line? Eg. Dim sText1 Dim sText2 sText1, sText2 = "" 'this doesn't work! I actually have about 20 of these variables that I want to set to blank before working with them, and having the same line 20 times seems to be rather inefficient. This is in Office 2003, if that makes a difference. TIA Dave |
Set Multiple Variables
Darn! (or words to that effect)
Thanks anyway "Mike H" wrote: Hi, You can't reset a group of individual variables in one go, it would have to be done one at a time. Mike "Risky Dave" wrote: Hi, If I have Dim'd a bunch of string variables, is it possible to set them all to the same value in a single line? Eg. Dim sText1 Dim sText2 sText1, sText2 = "" 'this doesn't work! I actually have about 20 of these variables that I want to set to blank before working with them, and having the same line 20 times seems to be rather inefficient. This is in Office 2003, if that makes a difference. TIA Dave |
All times are GMT +1. The time now is 12:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com