ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Halfway to End (https://www.excelbanter.com/excel-discussion-misc-queries/111618-halfway-end.html)

Rokuro kubi

Halfway to End
 
How do I select the bottom half of a column's cells in a macro?


Don Guillett

Halfway to End
 
with/without blanks and why

--
Don Guillett
SalesAid Software

"Rokuro kubi" wrote in message
ups.com...
How do I select the bottom half of a column's cells in a macro?




Bob Umlas

Halfway to End
 
Sub Untested()
Rw = Range("A65536").End(xlUp).Row 'change "A" to the column you're
interested in
Rw = Rw \ 2
Range(Range("A1").Offset(Rw), Range("A65536").End(xlUp)).Select
End Sub


"Rokuro kubi" wrote in message
ups.com...
How do I select the bottom half of a column's cells in a macro?




[email protected]

Halfway to End
 
Hello,

For example:
Dim i As Long, j As Long
i = Range("A1").Column
j = Cells(65536, i).End(xlUp).Row
Range(Cells(j / 2 + 1, i), Cells(j, i)).Select

HTH,
Bernd


Don Guillett

Halfway to End
 
Sub selecthalfcolumn()'ignores blanks
lr = Cells(Rows.Count, "a").End(xlUp).Row / 2
Range(Cells(1, 1), Cells(lr, 1)).Select
End Sub

--
Don Guillett
SalesAid Software

"Rokuro kubi" wrote in message
ups.com...
How do I select the bottom half of a column's cells in a macro?




Gary''s Student

Halfway to End
 
Because a column always contains 65536 cells, the bottom half is 32769 thru
65536. For example:

Sub gsnu()
Range("A32769:A65536").Select
End Sub
--
Gary's Student


"Rokuro kubi" wrote:

How do I select the bottom half of a column's cells in a macro?



Rokuro kubi

Halfway to End
 

Don Guillett wrote:

with/without blanks and why

--
Don Guillett
SalesAid Software

"Rokuro kubi" wrote in message
ups.com...
How do I select the bottom half of a column's cells in a macro?


Hi Don,
The sheet is fairly uniform - there will be data in every cell in that
column until the last usedrow of the sheet. Exactly half of the
figures in column F will be duplicates and column E will be always be
one of two values. I need to lose the data directly adjacent to all
cells showing Value 2.


Rokuro kubi

Halfway to End
 

Don Guillett wrote:

Sub selecthalfcolumn()'ignores blanks
lr = Cells(Rows.Count, "a").End(xlUp).Row / 2
Range(Cells(1, 1), Cells(lr, 1)).Select
End Sub

--
Don Guillett
SalesAid Software

"Rokuro kubi" wrote in message
ups.com...
How do I select the bottom half of a column's cells in a macro?


That's great Don, cheers


Don Guillett

Halfway to End
 
65536 wont be true with next xl version

column's cells


--
Don Guillett
SalesAid Software

"Gary''s Student" wrote in message
...
Because a column always contains 65536 cells, the bottom half is 32769
thru
65536. For example:

Sub gsnu()
Range("A32769:A65536").Select
End Sub
--
Gary's Student


"Rokuro kubi" wrote:

How do I select the bottom half of a column's cells in a macro?






All times are GMT +1. The time now is 10:41 PM.

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