Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Variables Faraz A. Qureshi Excel Programming 1 September 11th 09 07:07 AM
how can i count multiple variables in multiple columns? GVPro Excel Programming 1 November 19th 08 05:01 AM
Multiple variables-SOS Ang Excel Worksheet Functions 3 April 27th 07 08:24 PM
look for a value with multiple variables Andrea Excel Discussion (Misc queries) 2 January 18th 07 12:24 PM
Multiple variables sip8316 Excel Programming 8 June 7th 05 03:48 PM


All times are GMT +1. The time now is 03:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"