Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Problem setting each parameter in an Array = Nothing

I want to reset each parameter in an Array = 0 or " ". Why can I not make
myDes = Nothing. I am getting an error below. If I set myDes = 0 everything
works fine, but it will not work when myDes = Nothing

Sub ResetVariables()

Dim myBOM_Des As Variant
Dim myDes As Variant

' row location of part on "Parts List"
myBOM_Des = Array(AlumFace_Row, Texture_Row, Primer_Row, Paint1_Row,
Paint2_Row, Paint3_Row, Paint4_Row, Vinyl1_Row, _
Vinyl2_Row, Vinyl3_Row, Vinyl4_Row,
ClearVinyl_Row, Ink_Row, Plastic_Row)

' sets row locations to Nothing
For Each myDes In myBOM_Des
ERROR = myDes = Nothing
Next myDes.

End Sub

--
Cheers,
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 221
Default Problem setting each parameter in an Array = Nothing

G'day Ryan

Try

MyDes= ""

HTH
Mark.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 221
Default Problem setting each parameter in an Array = Nothing

Oops

MyDes = "Nothing"

Mark.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Problem setting each parameter in an Array = Nothing

I know that would work. I was wondering why myDes = Nothing does not work?
Any ideas?
--
Cheers,
Ryan


"NoodNutt" wrote:

G'day Ryan

Try

MyDes= ""

HTH
Mark.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Problem setting each parameter in an Array = Nothing

You are setting myDes = "Nothing" which is a String. I am curious why I
can't set myDes = Nothing, as in = 0 or " ".

--
Cheers,
Ryan


"NoodNutt" wrote:

Oops

MyDes = "Nothing"

Mark.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Problem setting each parameter in an Array = Nothing

Try
Set myDes = nothing

"RyanH" wrote in message
...
I want to reset each parameter in an Array = 0 or " ". Why can I not make
myDes = Nothing. I am getting an error below. If I set myDes = 0
everything
works fine, but it will not work when myDes = Nothing

Sub ResetVariables()

Dim myBOM_Des As Variant
Dim myDes As Variant

' row location of part on "Parts List"
myBOM_Des = Array(AlumFace_Row, Texture_Row, Primer_Row,
Paint1_Row,
Paint2_Row, Paint3_Row, Paint4_Row, Vinyl1_Row, _
Vinyl2_Row, Vinyl3_Row, Vinyl4_Row,
ClearVinyl_Row, Ink_Row, Plastic_Row)

' sets row locations to Nothing
For Each myDes In myBOM_Des
ERROR = myDes = Nothing
Next myDes.

End Sub

--
Cheers,
Ryan



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Problem setting each parameter in an Array = Nothing

Do you still use Set even though the myDes Data Type is Variant, but it is
only a Integer?
--
Cheers,
Ryan


"Fred" wrote:

Try
Set myDes = nothing

"RyanH" wrote in message
...
I want to reset each parameter in an Array = 0 or " ". Why can I not make
myDes = Nothing. I am getting an error below. If I set myDes = 0
everything
works fine, but it will not work when myDes = Nothing

Sub ResetVariables()

Dim myBOM_Des As Variant
Dim myDes As Variant

' row location of part on "Parts List"
myBOM_Des = Array(AlumFace_Row, Texture_Row, Primer_Row,
Paint1_Row,
Paint2_Row, Paint3_Row, Paint4_Row, Vinyl1_Row, _
Vinyl2_Row, Vinyl3_Row, Vinyl4_Row,
ClearVinyl_Row, Ink_Row, Plastic_Row)

' sets row locations to Nothing
For Each myDes In myBOM_Des
ERROR = myDes = Nothing
Next myDes.

End Sub

--
Cheers,
Ryan




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,231
Default Problem setting each parameter in an Array = Nothing

"Dana DeLouis" wrote...
....
How about Empty ??

....

Definitely a better choice for Variants.

Nothing is used for object references, as it says in online help: 'The
Nothing keyword is used to disassociate an object variable from an
actual object.' Online help simply isn't explicit that VBA's Nothing
keyword is exclusively for this purpose.
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Problem setting each parameter in an Array = Nothing

Hi Ryan,

Nothing is used for objects so by setting your variant myDes to Nothing you
are telling the compiler/Intepreter that myDes is an Object so it becomes a
Variant/Object, it is certainly not a Variant/Integer. If you want the
variant to be a Variant/Integer then you should use Empty not Nothing.
You should note that if you set myDes to Nothing then you cannot set an
integer variable equal to myDes whereas if you set myDes to Empty then you
can set an integer variable to myDes and the integer will be set to 0.

Hope this clarifies it for you
Fred

"RyanH" wrote in message
...
Do you still use Set even though the myDes Data Type is Variant, but it is
only a Integer?
--
Cheers,
Ryan


"Fred" wrote:

Try
Set myDes = nothing

"RyanH" wrote in message
...
I want to reset each parameter in an Array = 0 or " ". Why can I not
make
myDes = Nothing. I am getting an error below. If I set myDes = 0
everything
works fine, but it will not work when myDes = Nothing

Sub ResetVariables()

Dim myBOM_Des As Variant
Dim myDes As Variant

' row location of part on "Parts List"
myBOM_Des = Array(AlumFace_Row, Texture_Row, Primer_Row,
Paint1_Row,
Paint2_Row, Paint3_Row, Paint4_Row, Vinyl1_Row, _
Vinyl2_Row, Vinyl3_Row, Vinyl4_Row,
ClearVinyl_Row, Ink_Row, Plastic_Row)

' sets row locations to Nothing
For Each myDes In myBOM_Des
ERROR = myDes = Nothing
Next myDes.

End Sub

--
Cheers,
Ryan






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
?? Create a Public SUB with an array as parameter. ?? Barb Excel Programming 1 July 24th 07 03:25 AM
SOS-How to pass array parameter to Workbooks.OpenText(...) in VC++ Lily Excel Programming 1 September 27th 05 02:05 PM
ReDim Object array as parameter of Variant array Peter T Excel Programming 4 May 10th 05 02:11 PM
Excel2000: Declaring function parameter as an array Arvi Laanemets Excel Programming 6 April 25th 05 01:14 PM
Excel2000: UDF's parameter as cell range OR array Arvi Laanemets Excel Programming 2 April 19th 05 02:27 PM


All times are GMT +1. The time now is 05:33 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"