0

I am trying to use a variable alongside the offset function to create a range which I can then utilise.

I have the below code however this errors on the last line.

Dim rng As Range
Dim targetrow As Range
targetrow = ActiveSheet.Range("Total").Offset(-2, 0).Row
rng = Range(Cells((targetrow), 7), Cells(10, 7))

Any help would be much appreciated

Thanks

1 Answer 1

1

You need to use Set with object variables:

Set rng = Range(Cells((targetrow), 7), Cells(10, 7))
Sign up to request clarification or add additional context in comments.

1 Comment

And you need to declare targetrow as Long instead of Range

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.