Strange offset fault

  • Thread starter Thread starter ramcsir
  • Start date Start date
R

ramcsir

Hallo, programmers

I have the following code:

Dim rng As String
Dim i As Integer

rng = "$A$1"
For i = 0 To 3
Debug.Print rng & " / " & Range(rng).offset(i, 1).Address
Next i

It produces the following results:

$A$1 / $C$1
$A$1 / $C$4
$A$1 / $C$5
$A$1 / $C$6

If you ask me it should produced the results

$A$1 / $B$1
$A$1 / $B$2
$A$1 / $B$3
$A$1 / $B$4

Can anybody tell me I am doing wrong.
Thanks in advance.

Ramcsir
 
I just tried your code and it produced the results you expected

$A$1 / $B$1
$A$1 / $B$2
$A$1 / $B$3
$A$1 / $B$4

maybe there is something else going on
 
I tried it and got the correct results also.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top