Excel Range Leftmost and Rightmost columns

  • Thread starter msnews.microsoft.com
  • Start date
M

msnews.microsoft.com

Hi,

if i have an excel range, how can i find out the leftmost column and right
most column in the range easily?

is the only way to examine each column in the range?

thanks
 
J

Jeff Hopper

Dim rng As Range
Dim leftCol As Range
Dim rightCol As Range

Set rng = Selection 'or whatever range you're after
Set leftCol = rng.Columns(1)
Set rightCol = rng.Columns(rng.Columns.Count)
 
M

msnews.microsoft.com

thanks!

Jeff Hopper said:
Dim rng As Range
Dim leftCol As Range
Dim rightCol As Range

Set rng = Selection 'or whatever range you're after
Set leftCol = rng.Columns(1)
Set rightCol = rng.Columns(rng.Columns.Count)
 
Top