Resizing a range to contain the entire row

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:53 PM GMT

QuestionEdit

I created a range (Rng) that contains three cells such that msgbox Rng.Address = $H$4,$H$6, $F$8

Is there a simple way to resize the range so that it will contain all of row 4, all of row 6, and all of row 8?

AnswerEdit

steve

set rng = rng.EntireRow

here is a demonstration from the immediate window in the Visual Basic Editor (VBE)

set rng = Range("H4,H6,F8") ? rng.Address $H$4,$H$6,$F$8 ? rng.entireRow.address $4:$4,$6:$6,$8:$8

set rng = rng.EntireRow

? rng.Address $4:$4,$6:$6,$8:$8

Advertisement

©2024 eLuminary LLC. All rights reserved.