JoaMika
JoaMika

Reputation: 1827

Offset Column in Range in Excel VBA

I am using this code to set a range:

Set rngsearch = xGBP.Range("B1", Columns("B").Find(1, Cells(Rows.count - 1, "B")).Offset(-1))

This works fine. Then what I want is to offset this range to pick column E instead of B and tried:

rngsearch = rngsearch.Offset(0, 3)

My test shows this returns an empty array. Any solutions?

Upvotes: 0

Views: 1492

Answers (1)

Dustin
Dustin

Reputation: 411

Your second line of code is missing the Set command. When assigning an object (such as a range) you have to set the object variable equal to the object.

Set rngsearch = rngsearch.Offset(0,3)

Upvotes: 3

Related Questions