rainbowthug
rainbowthug

Reputation: 77

From first element to the last but one VBA

As the title says, my problem is to select range from the first element to the last but one, so for example I got range from A1 to A10 and i want it to be selected from A1 to A9

So far I know only how to select entire range which is Set NameRange = Range("A1", Range("A1").End(xlDown)) tired something along the lines Set NameRange = Range("A1", Range("A1").End(xlDown))-1 or Set NameRange = Range("A1", Range("A1").End(xlDown)-1) but none of it works

I'd greatly appreciate help from you

Upvotes: 0

Views: 95

Answers (1)

John Coleman
John Coleman

Reputation: 52008

Set NameRange = Range("A1", Range("A1").End(xlDown).Offset(-1))

should work.

Upvotes: 1

Related Questions