Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Select Activecell and 65 Rows to the Right

I want to go to the last used cell in Column A, move over 5 to the right, and
then select the range from Column F to Column BR. I'm trying to run the code
below, keeps failing on this line:
ActiveCell.Resize(0, 65).Select

Code:
Cells(Rows.Count, "A").End(xlUp).Select
ActiveCell.Offset(0, 5).Select
ActiveCell.Resize(0, 65).Select

Selection.Copy
Sheets("Scoring_Sheet").Select
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

I must be missing something pretty basic. I thought this was done with
resize and select.

Any suggestions?

Thanks,
Ryan---

--
RyGuy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Select Activecell and 65 Rows to the Right

Neither the move 5 or the resize is necessary:

Sub asdf()
n = Cells(Rows.Count, "A").End(xlUp).Row
Range("F" & n & ":BR" & n).Select
End Sub

--
Gary''s Student - gsnu200822
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Select Activecell and 65 Rows to the Right

Hummm, you are right. Works fine now. Thanks a lot!
Besides being less efficient, what is wrong with this:
ActiveCell.Offset(0, 5).Select
ActiveCell.Resize(0, 65).Select

Thanks,
Ryan---

--
RyGuy


"Gary''s Student" wrote:

Neither the move 5 or the resize is necessary:

Sub asdf()
n = Cells(Rows.Count, "A").End(xlUp).Row
Range("F" & n & ":BR" & n).Select
End Sub

--
Gary''s Student - gsnu200822

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Select Activecell and 65 Rows to the Right

But, if you wanted to use Offset and Resize, that could be done quite
compactly...

Sub asdf()
Cells(Rows.Count, "A").End(xlUp).Offset(, 5).Resize(1, 65).Select
End Sub

--
Rick (MVP - Excel)


"Gary''s Student" wrote in message
...
Neither the move 5 or the resize is necessary:

Sub asdf()
n = Cells(Rows.Count, "A").End(xlUp).Row
Range("F" & n & ":BR" & n).Select
End Sub

--
Gary''s Student - gsnu200822


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Select Activecell and 65 Rows to the Right

You can't use 0 rows high for the Resize... either leave it out and Excel
will figure it out... Resize(,65)... or use 1 for the height... Resize(1,
65). You can combine both of those operations into a single statement...

ActiveCell.Offset(, 5).Resize(, 65).Select

--
Rick (MVP - Excel)


"ryguy7272" wrote in message
...
Hummm, you are right. Works fine now. Thanks a lot!
Besides being less efficient, what is wrong with this:
ActiveCell.Offset(0, 5).Select
ActiveCell.Resize(0, 65).Select

Thanks,
Ryan---

--
RyGuy


"Gary''s Student" wrote:

Neither the move 5 or the resize is necessary:

Sub asdf()
n = Cells(Rows.Count, "A").End(xlUp).Row
Range("F" & n & ":BR" & n).Select
End Sub

--
Gary''s Student - gsnu200822




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Select Activecell and 65 Rows to the Right

Ah! Thanks for the insight Rick!
Happy Holidays!!
Ryan--

--
RyGuy


"Rick Rothstein" wrote:

But, if you wanted to use Offset and Resize, that could be done quite
compactly...

Sub asdf()
Cells(Rows.Count, "A").End(xlUp).Offset(, 5).Resize(1, 65).Select
End Sub

--
Rick (MVP - Excel)


"Gary''s Student" wrote in message
...
Neither the move 5 or the resize is necessary:

Sub asdf()
n = Cells(Rows.Count, "A").End(xlUp).Row
Range("F" & n & ":BR" & n).Select
End Sub

--
Gary''s Student - gsnu200822



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
Select ActiveCell Range Tanya Excel Programming 3 May 26th 07 01:36 AM
ActiveCell.Row in Range().Select? thebluerider Excel Programming 1 August 19th 06 11:40 AM
Range Select with ActiveCell and Offset property AJ Master[_9_] Excel Programming 2 June 20th 06 11:26 PM
select range next to activecell lookin Excel Programming 3 March 29th 06 07:56 PM
Select Activecell in Range PraxisPete Excel Programming 0 June 1st 05 01:23 PM


All times are GMT +1. The time now is 12:18 AM.

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"