ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select Activecell and 65 Rows to the Right (https://www.excelbanter.com/excel-programming/421620-select-activecell-65-rows-right.html)

ryguy7272

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

Gary''s Student

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

ryguy7272

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


Rick Rothstein

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



Rick Rothstein

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



ryguy7272

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





All times are GMT +1. The time now is 10:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com