xcel 2000 Vs xcel97

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
hi everyone!
Is this expression not supported in xcel '97

<font face=Courier New>        <SPAN style="color:#00007F">Set</SPAN> X1 = Worksheets("Training Log").Range("C" & FIRST & ":C" & LAST)
            TMP = X1.Value
            Worksheets("90R Data").Range("B2:B91") = TMP</FONT>

this works fine in 2000. But I got a feed back that he
gets and error of

Code:
"Compile Error: Can't assign to Array"


thanks
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Colo

MrExcel MVP,
Joined
Mar 20, 2002
Messages
1,659
Office Version
  1. 2016
  2. 2003 or older
Platform
  1. Windows
Hi SIXTH SENSE,

I think it works in 97. In this case a variable named TMP should be a Variant type.
In your code, since the declaration part was omitted so a variable TMP has been treated as Variant type.
k, to make sure the problem I'll re-write your code as simple one.

Code:
Sub TEST()
    Dim X1 As Range
    Dim TMP As Variant
    Set X1 = Worksheets(1).Range("A1:A10")
    TMP = X1.Value
    Worksheets(1).Range("B1:B10").Value = TMP
End Sub
 

NateO

Legend
Joined
Feb 17, 2002
Messages
9,700
Agreeing with Colo, this is going to be true of any quick-stacked array eh, e.g.,

<font face=Courier New><SPAN style="color:darkblue">Sub</SPAN> Quick_Stack()
<SPAN style="color:darkblue">Dim</SPAN> myArr1 <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Variant</SPAN>, myArr2 <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Variant</SPAN>, myArr3 <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Variant</SPAN>
myArr1 = Array(1, 2, 3)
myArr2 = [{1,2,3}]
myArr3 = [Transpose(Offset(O11,(Row(1:5)-1)*7+1,0,1,3))]
<SPAN style="color:darkblue">Debug</SPAN>.<SPAN style="color:darkblue">Print</SPAN> myArr3(UBound(myArr3)).Address
<SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">Sub</SPAN></FONT>
 

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
Colo said:
Hi SIXTH SENSE,

I think it works in 97. In this case a variable named TMP should be a Variant type.
In your code, since the declaration part was omitted so a variable TMP has been treated as Variant type.
k, to make sure the problem I'll re-write your code as simple one.

Code:
Sub TEST()
    Dim X1 As Range
    Dim TMP As Variant
    Set X1 = Worksheets(1).Range("A1:A10")
    TMP = X1.Value
    Worksheets(1).range("B1:B10").Value = TMP
End Sub


Thanks colo.

I declare the variable tmp as

Code:
       dim tmp()

which I think by difualt is variant!
Is it something different from

Code:
      dim tmp as variant

TY.
 

Colo

MrExcel MVP,
Joined
Mar 20, 2002
Messages
1,659
Office Version
  1. 2016
  2. 2003 or older
Platform
  1. Windows
SIXTH SENSE said:
Thanks colo.

I declare the variable tmp as

Code:
       dim tmp()

which I think by difualt is variant!
Is it something different from

Code:
      dim tmp as variant

TY.

Hi, SS!

It's different. TMP() is treated as an array/variant.

Code:
Sub Test1()
    Dim TMP()
    Debug.Print TypeName(TMP)
    Debug.Print IsArray(TMP)
End Sub

Sub Test2()
    Dim TMP
    Debug.Print TypeName(TMP)
    Debug.Print IsArray(TMP)
End Sub
 

Forum statistics

Threads
1,186,162
Messages
5,956,283
Members
438,245
Latest member
bhavdip_mangukiya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top