0
votes

I am trying to test offset property in excel vba . I am using a simple code which selects the cell which is daigonal , i.e 1 row and 1 column away from the active cell.

This is what I am doing

Sub Range_Offset()

Range(ActiveCell).Offset(1, 1).Select

End Sub

I have attached the code to a button on the sheet.

When I am clicking the button , I am getting the following error

Run-time error '1004'
Method 'Range' of object '_Global' failed

If i replacing the ActiveCell with any cell number its working . But why is ActiveCell not working. Thanks

1
Try ActiveCell.Offset(1,1).Select insteadPeter
thanx @Peter . it worksMukesh Kumar Singh

1 Answers

2
votes

Try: ActiveCell.Offset(1,1).select
ActiveCell is already a range object, and you don't need to use Range() to turn it into range.