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

Re: Problem setting each parameter in an Array = Nothing by NoodNutt

NoodNutt
Fri Jul 25 07:29:40 CDT 2008

G'day Ryan

Try

MyDes= ""

HTH
Mark.



Re: Problem setting each parameter in an Array = Nothing by NoodNutt

NoodNutt
Fri Jul 25 07:31:30 CDT 2008

Oops

MyDes = "Nothing"

Mark.



Re: Problem setting each parameter in an Array = Nothing by RyanH

RyanH
Fri Jul 25 07:34:04 CDT 2008

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.
>
>
>

Re: Problem setting each parameter in an Array = Nothing by RyanH

RyanH
Fri Jul 25 07:41:02 CDT 2008

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.
>
>
>

Re: Problem setting each parameter in an Array = Nothing by Fred

Fred
Fri Jul 25 07:48:58 CDT 2008

Try
Set myDes = nothing

"RyanH" <RyanH@discussions.microsoft.com> wrote in message
news:F48BD878-9EDF-4F34-A9AE-E4452DE23E86@microsoft.com...
>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



Re: Problem setting each parameter in an Array = Nothing by RyanH

RyanH
Fri Jul 25 09:41:05 CDT 2008

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" <RyanH@discussions.microsoft.com> wrote in message
> news:F48BD878-9EDF-4F34-A9AE-E4452DE23E86@microsoft.com...
> >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
>
>
>

Re: Problem setting each parameter in an Array = Nothing by Harlan

Harlan
Sat Jul 26 01:42:45 CDT 2008

"Dana DeLouis" <ddelo...@bellsouth.net> 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.

Re: Problem setting each parameter in an Array = Nothing by Fred

Fred
Sat Jul 26 04:15:30 CDT 2008

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" <RyanH@discussions.microsoft.com> wrote in message
news:DFF06A3C-BBE9-453C-938E-46B594B7ABDF@microsoft.com...
> 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" <RyanH@discussions.microsoft.com> wrote in message
>> news:F48BD878-9EDF-4F34-A9AE-E4452DE23E86@microsoft.com...
>> >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
>>
>>
>>