ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select range from ActiveCell do to Lastcell in ColumnA (https://www.excelbanter.com/excel-programming/440664-select-range-activecell-do-lastcell-columna.html)

Aussie Bob C

Select range from ActiveCell do to Lastcell in ColumnA
 
Range("A10:M" & Range("A10000").End(xlUp).Row.Cut
will cut a range from Cell A10 across to Column M and down to last cell in
Column A
How do you replace reference to Cell A10 with ActiveCell in Column A?

--
Thank you

Aussie Bob C
Little cost to carry knowledge with you.
Win XP P3 Office 2007 on Mini Mac using VMware.

Barb Reinhardt

Select range from ActiveCell do to Lastcell in ColumnA
 
Dim lRow as long
Dim myRange as Excel.range
Dim aWS as excel.worksheet

set aWS = activesheet
Set myRange = aws.Range("A10")
lRow = aws.cells(aws.rows.count,myrange.row).end(xlup).ro w
set myrange = myrange.resize(lrow-myrange.row + 1,13)
debug.print myrange.address


--
HTH,

Barb Reinhardt



"Aussie Bob C" wrote:

Range("A10:M" & Range("A10000").End(xlUp).Row.Cut
will cut a range from Cell A10 across to Column M and down to last cell in
Column A
How do you replace reference to Cell A10 with ActiveCell in Column A?

--
Thank you

Aussie Bob C
Little cost to carry knowledge with you.
Win XP P3 Office 2007 on Mini Mac using VMware.


Aussie Bob C

Select range from ActiveCell do to Lastcell in ColumnA
 
My mention of cell A10 was an example used in the code.
The ActiveCell could be any Column A cell the user selects.
The range selected from ActiveCell down to last cell containing data in
Column A and include cells straight across to Column M.
Column M may be shorter than A but never longer.
My problem is coding a substitute an ActiveCell for A10 in codecode.
--
Thank you

Aussie Bob C
Little cost to carry knowledge with you.
Win XP P3 Office 2007 on Mini Mac using VMware.


"Barb Reinhardt" wrote:

Dim lRow as long
Dim myRange as Excel.range
Dim aWS as excel.worksheet

set aWS = activesheet
Set myRange = aws.Range("A10")
lRow = aws.cells(aws.rows.count,myrange.row).end(xlup).ro w
set myrange = myrange.resize(lrow-myrange.row + 1,13)
debug.print myrange.address


--
HTH,

Barb Reinhardt



"Aussie Bob C" wrote:

Range("A10:M" & Range("A10000").End(xlUp).Row.Cut
will cut a range from Cell A10 across to Column M and down to last cell in
Column A
How do you replace reference to Cell A10 with ActiveCell in Column A?

--
Thank you

Aussie Bob C
Little cost to carry knowledge with you.
Win XP P3 Office 2007 on Mini Mac using VMware.


Jacob Skaria

Select range from ActiveCell do to Lastcell in ColumnA
 
Range(ActiveCell, "M" & Cells(Rows.Count, "A").End(xlUp).Row).Cut

OR if the active cell is not in ColA

Range("A" & ActiveCell.Row & ":M" & Cells(Rows.Count, "A").End(xlUp).Row).Cut


--
Jacob


"Aussie Bob C" wrote:

Range("A10:M" & Range("A10000").End(xlUp).Row.Cut
will cut a range from Cell A10 across to Column M and down to last cell in
Column A
How do you replace reference to Cell A10 with ActiveCell in Column A?

--
Thank you

Aussie Bob C
Little cost to carry knowledge with you.
Win XP P3 Office 2007 on Mini Mac using VMware.



All times are GMT +1. The time now is 11:31 AM.

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