Select Activecell and 65 Rows to the Right

R

ryguy7272

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---
 
G

Gary''s Student

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
 
R

ryguy7272

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---
 
R

Rick Rothstein

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
 
R

Rick Rothstein

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top