Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default Selecting a range

Hello,

Looking for a macro that selects a range from a portion of a row which is
the Active Selection to the last non blank row bellow in the same columns as
the Active Selection. The address of the current selection should be
determined by VBA

Thanks a lot


Avi


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Selecting a range

Hi Arvi,

Try:
'=============
Public Sub Tester005()
Dim rng As Range
Dim FRow As Long
Dim LRow As Long

FRow = Selection.Row
LRow = Cells(Rows.Count, Selection.Column).End(xlUp).Row

Set rng = Selection.Resize(LRow - FRow + 1)
rng.Select

End Sub
'<<=============


---
Regards,
Norman


"Avi" wrote in message
...
Hello,

Looking for a macro that selects a range from a portion of a row which is
the Active Selection to the last non blank row bellow in the same columns
as the Active Selection. The address of the current selection should be
determined by VBA

Thanks a lot


Avi



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Selecting a range

A single column or the same size as the original selection


Dim TopCell As Range
Dim BotCell As Range

With ActiveSheet
Set TopCell = ActiveCell
Set BotCell = .Cells(.Rows.Count, TopCell.Column).End(xlUp)
'one column
'.Range(TopCell, BotCell).Select
'or maybe multiple columns
'.Range(TopCell, BotCell).Resize(, Selection.Columns.Count).Select
End With




Avi wrote:

Hello,

Looking for a macro that selects a range from a portion of a row which is
the Active Selection to the last non blank row bellow in the same columns as
the Active Selection. The address of the current selection should be
determined by VBA

Thanks a lot

Avi


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Selecting a range

Hi Arvi,

Try:
'=============
Public Sub Tester005()
Dim rng As Range
Dim FRow As Long
Dim LRow As Long

FRow = Selection.Row
LRow = Cells(Rows.Count, Selection.Column).End(xlUp).Row

Set rng = Selection.Resize(LRow - FRow + 1)
rng.Select

End Sub
'<<=============


---
Regards,
Norman


"Avi" wrote in message
...
Hello,

Looking for a macro that selects a range from a portion of a row which is
the Active Selection to the last non blank row bellow in the same columns
as the Active Selection. The address of the current selection should be
determined by VBA

Thanks a lot


Avi



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
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Help please in selecting range dependent on another range MickJJ Excel Programming 2 January 10th 05 12:01 PM
Selecting a Range inside a range hcova Excel Programming 0 July 13th 04 03:26 PM
Selecting a Range Karen[_10_] Excel Programming 4 October 14th 03 10:57 PM


All times are GMT +1. The time now is 01:29 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"