TonyJollans
Programmer
Hi All,
Whilst looking at a problem in another thread I came across something I can’t explain. Can somebody else, please?
Copying a range from one sheet to another in the same workbook doesn’t cause me any problem. Both displays in the code below give Sheet1 $A$7 Sheet1 $A$12 as I would expect.
Cutting the same range causes my Range variables to be changed to reflect the cell range from the destination and the sheet from the source. This time the first display gives Sheet1 $A$7 Sheet1 $A$12 as before but the second gives Sheet1 $A$1 Sheet1 $A$6.
If that’s just the way it works I can live with it (I’ll have to live with it) but I can’t find anything to suggest so. What am I doing wrong?
Thanks,
Tony
Whilst looking at a problem in another thread I came across something I can’t explain. Can somebody else, please?
Copying a range from one sheet to another in the same workbook doesn’t cause me any problem. Both displays in the code below give Sheet1 $A$7 Sheet1 $A$12 as I would expect.
Code:
Dim tjStart As Range
Dim tjEnd As Range
Set tjStart = Worksheets("Sheet1").Range("A7")
Set tjEnd = Worksheets(“Sheet1”).Range("A12")
MsgBox tjStart.Worksheet.Name & “ “ & tjStart.Address & " " & tjEnd.Worksheet.Name & “ “ & tjEnd.Address
Range(tjStart, tjEnd).
Code:
Copy
Code:
Destination:=Worksheets("Sheet2").Range("A1")
MsgBox tjStart.Worksheet.Name & “ “ & tjStart.Address & " " & tjEnd.Worksheet.Name & “ “ & tjEnd.Address
Cutting the same range causes my Range variables to be changed to reflect the cell range from the destination and the sheet from the source. This time the first display gives Sheet1 $A$7 Sheet1 $A$12 as before but the second gives Sheet1 $A$1 Sheet1 $A$6.
Code:
Dim tjStart As Range
Dim tjEnd As Range
Set tjStart = Worksheets("Sheet1").Range("A7")
Set tjEnd = Worksheets(“Sheet1”).Range("A12")
MsgBox tjStart.Worksheet.Name & “ “ & tjStart.Address & " " & tjEnd.Worksheet.Name & “ “ & tjEnd.Address
Range(tjStart, tjEnd).
Code:
Cut
Code:
Destination:=Worksheets("Sheet2").Range("A1")
MsgBox tjStart.Worksheet.Name & “ “ & tjStart.Address & " " & tjEnd.Worksheet.Name & “ “ & tjEnd.Address
If that’s just the way it works I can live with it (I’ll have to live with it) but I can’t find anything to suggest so. What am I doing wrong?
Thanks,
Tony