Why I get error when pass range defined as string into range

Viewed 48

Here is my simple code

Sub SavePrices()
'
' SavePrices saves spot prices from Sheet 'Spot' into Sheet 'saved prices'
'
Dim MyRangeS As String
MyRangeS = Sheets("saved prices").Range("I1").Value

Sheets("saved prices").Range(MyRangeS).Value = Sheets("Spot").Range("A2:C112").Value

End Sub

In cell I1 there is a VLOOKUP formula which gives a result A2:C113. When I run the code it gives 1004 Error. If I put A2:C113 i/o MyRangeS it works. While debugging MyRangeS equals to "A2:C113".

Have no idea what it can be.

Please advise.

P.S. The code is written in Module.

1 Answers

I found the mistake, the string which I passed to Range was "A2:C112", but letters were typed with Ukrainian language. So it looked totally the same but didn't work.

Related