Maciej Matuszczak
Maciej Matuszczak

Reputation: 89

Not to select last column in named range vba

I have this code:

With Range("OriginSize")
.RowHeight = 12.75
.ColumnWidth = 3
End With

But I do not want last column of this range to be touched. Anybody know ? Thanks

Upvotes: 0

Views: 129

Answers (1)

You should use

With Range("OriginSize").Resize(Range("OriginSize").Rows.Count,Range("OriginSize").Columns.Count-1)
.RowHeight = 12.75
.ColumnWidth = 3
End With

Resize (https://msdn.microsoft.com/en-us/library/office/ff193274.aspx) allows you to change the size of a range.

Upvotes: 1

Related Questions