Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Use xldown to select a range of cells

Hiya,

When I run the macro using this code:

Range("A4:R4").Select
Selection.End(xlDown).Activate
Selection.Copy

Only the bottom left cell is being selected. I need the whole range to be
selected.
Can anyone help please?

Thanks
merry_fay
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,276
Default Use xldown to select a range of cells

Hi ,
if you always want to select A4 to R4 just use
Range("A4:R4").Select

"merry_fay" wrote:

Hiya,

When I run the macro using this code:

Range("A4:R4").Select
Selection.End(xlDown).Activate
Selection.Copy

Only the bottom left cell is being selected. I need the whole range to be
selected.
Can anyone help please?

Thanks
merry_fay

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,276
Default Use xldown to select a range of cells

OPPs
, I sent the message before finishing

if you want to select from A4 up to the last row used in R

Sub Macro1()
'
' Macro1 Macro
'

Dim myrange, MyRange1 As Range
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Set myrange = Sheets("Sheet1").Range("A4:R" & lastRow)
myrange.Copy
End Sub

if this helps please click yes, thanks

"Eduardo" wrote:

Hi ,
if you always want to select A4 to R4 just use
Range("A4:R4").Select

"merry_fay" wrote:

Hiya,

When I run the macro using this code:

Range("A4:R4").Select
Selection.End(xlDown).Activate
Selection.Copy

Only the bottom left cell is being selected. I need the whole range to be
selected.
Can anyone help please?

Thanks
merry_fay

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Use xldown to select a range of cells

Generally speaking you are better to use xlup from the bottom (which stops at
the last complete cell of the worksheet) than xldown (which stops at the
first blank).

in either case you don't need to select

Range(Range("A4"), Cells(Rows.Count, "A").End(xlUp)).Copy
'or
Range(Range("A4"), Range("A4").End(xlDown)).Copy

--
HTH...

Jim Thomlinson


"merry_fay" wrote:

Hiya,

When I run the macro using this code:

Range("A4:R4").Select
Selection.End(xlDown).Activate
Selection.Copy

Only the bottom left cell is being selected. I need the whole range to be
selected.
Can anyone help please?

Thanks
merry_fay

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
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
End(xlDown) not working? RAHokie Excel Discussion (Misc queries) 2 January 19th 07 12:40 AM
Select a range but only sum the cells in a certain colour? jlm2184 Excel Worksheet Functions 1 March 24th 06 11:50 AM
Select Range of Cells programmingrookie Excel Discussion (Misc queries) 2 August 11th 05 07:13 PM
select a range using "cells()" fullers Excel Worksheet Functions 2 July 6th 05 06:00 PM


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