Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Setting a range with the last used cell?

Simple answer im sure but it is Friday!!!!

Hi,

Im trying to select a range.

i.e Range("A1:A23456").select

however, the last cell will change as the range grows. I need to fin
the last used cell for my range to replace A23456 everytime I run th
macro.

Can someone quickly write me the code to find the last cell for m
range?

Cheers.

And

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Setting a range with the last used cell?

Andy,
Try UsedRange it returns A1 to the bottom right of the
active sheet

Trev
-----Original Message-----
Simple answer im sure but it is Friday!!!!

Hi,

Im trying to select a range.

i.e Range("A1:A23456").select

however, the last cell will change as the range grows. I

need to find
the last used cell for my range to replace A23456

everytime I run the
macro.

Can someone quickly write me the code to find the last

cell for my
range?

Cheers.

Andy


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Setting a range with the last used cell?

andy

Sub selectrange2()
''from top of column A to bottom of used range in column A including blanks
Range("A1").Select
Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column).End(xlUp)).Select
End Sub


Sub selectrange1()
''from activecell in any column to bottom of used range in column including
''blanks
Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column).End(xlUp)).Select
End Sub

Gord Dibben Excel MVP

On Fri, 2 Jul 2004 08:37:37 -0500, andycharger
wrote:

Simple answer im sure but it is Friday!!!!

Hi,

Im trying to select a range.

i.e Range("A1:A23456").select

however, the last cell will change as the range grows. I need to find
the last used cell for my range to replace A23456 everytime I run the
macro.

Can someone quickly write me the code to find the last cell for my
range?

Cheers.

Andy


---
Message posted from http://www.ExcelForum.com/


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
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
VBA setting Range Jeff Excel Discussion (Misc queries) 1 December 2nd 05 07:36 PM
Setting a range value to the last cell in active worksheet. Don Excel Programming 3 June 24th 04 02:04 PM
Setting a Range Tempy Excel Programming 6 June 15th 04 03:46 PM
range setting Mike Harris Excel Programming 5 November 22nd 03 05:07 AM


All times are GMT +1. The time now is 02:09 PM.

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

About Us

"It's about Microsoft Excel"