Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default resize range

I'm having problems to resize a range.
my data looks like this

x a d
x a d
x a d
y b

when I select the data the last row is included. is there any way to resize
the selection and exclude the last row (y)

thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default resize range

When you select the data how... in code? If so, show us your code.

--
Rick (MVP - Excel)


"Norma" wrote in message
...
I'm having problems to resize a range.
my data looks like this

x a d
x a d
x a d
y b

when I select the data the last row is included. is there any way to
resize
the selection and exclude the last row (y)

thank you


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default resize range

Try something like the following:

Dim Curr As Range
Dim R As Range
Set Curr = ActiveCell.CurrentRegion
With Curr
If .Rows.Count 1 Then
Set R = .Resize(.Rows.Count - 1, .Columns.Count)
End If
End With
R.Select


The CurrentRegion Curr is the rectangular region containing the
ActiveCell that is bounded on the sides by either all blank cells or
the end of the worksheet. The range R will refer to the CurrentRegion
excluding the last row.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Thu, 16 Oct 2008 11:18:02 -0700, Norma
wrote:

I'm having problems to resize a range.
my data looks like this

x a d
x a d
x a d
y b

when I select the data the last row is included. is there any way to resize
the selection and exclude the last row (y)

thank you

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default resize range

Thank you so much, it works!!!!!!

"Chip Pearson" wrote:

Try something like the following:

Dim Curr As Range
Dim R As Range
Set Curr = ActiveCell.CurrentRegion
With Curr
If .Rows.Count 1 Then
Set R = .Resize(.Rows.Count - 1, .Columns.Count)
End If
End With
R.Select


The CurrentRegion Curr is the rectangular region containing the
ActiveCell that is bounded on the sides by either all blank cells or
the end of the worksheet. The range R will refer to the CurrentRegion
excluding the last row.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Thu, 16 Oct 2008 11:18:02 -0700, Norma
wrote:

I'm having problems to resize a range.
my data looks like this

x a d
x a d
x a d
y b

when I select the data the last row is included. is there any way to resize
the selection and exclude the last row (y)

thank you


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help with Range.Resize Alexey[_3_] Excel Programming 2 September 1st 08 11:44 AM
Resize a range Oldjay Excel Programming 2 October 23rd 06 04:35 PM
Range.Delete and Range.Resize.Name performance issues Test.File Excel Programming 0 February 15th 05 03:33 PM
Range resize Ray Batig Excel Programming 4 September 7th 04 01:23 AM
Range Resize jacqui Excel Programming 2 April 6th 04 06:22 PM


All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"