ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select Half a Worksheet (https://www.excelbanter.com/excel-programming/388386-select-half-worksheet.html)

Battykoda

Select Half a Worksheet
 
Good Morning to you all.

Little question here today. I got a worksheet that the lenght can change for
month to month. All i need is to select only half the column in a macro. So
far i found how to make my macro select all of them, and it's no good.

Any suggestion?


Batty


Norman Jones

Select Half a Worksheet
 
Hi Batty,

could you elboarate on what you mean by 'half the column'


---
Regards,
Norman


"Battykoda" <u33810@uwe wrote in message news:717a119045498@uwe...
Good Morning to you all.

Little question here today. I got a worksheet that the lenght can change
for
month to month. All i need is to select only half the column in a macro.
So
far i found how to make my macro select all of them, and it's no good.

Any suggestion?


Batty




Battykoda

Select Half a Worksheet
 
There we go.

Let's say that right now, my worsheet that has 130 column. I need to be able
to get only 75 column of that. The point is, my report will expand every
month, so i want my macro to select half instead of just going to column 75.

After that, i have a serie of treatment that are going to be applied to that
half... but... right now... im stuck with the selection.

Clearer that way? (It is so clear in my mind... if only excel could get that!!
!)

Batty

Norman Jones wrote:
Hi Batty,

could you elboarate on what you mean by 'half the column'

---
Regards,
Norman

Good Morning to you all.

[quoted text clipped - 7 lines]

Batty



Mike H

Select Half a Worksheet
 
Hi Batty,

I'm a bit confused by 'half a column' but if you mean you want to select
your used range only and leave blank cell then something like this may help:-

Sub ranges()
Dim myrange As Range
rowno = ActiveSheet.Range("A65536").End(xlUp).Row
Set myrange = Range("A1:K" & rowno) '< Alter A1 and K to suit
myrange.Select
End Sub

Mike

"Battykoda" wrote:

Good Morning to you all.

Little question here today. I got a worksheet that the lenght can change for
month to month. All i need is to select only half the column in a macro. So
far i found how to make my macro select all of them, and it's no good.

Any suggestion?


Batty



Vergel Adriano

Select Half a Worksheet
 
like this?

Sub Test()
Dim iTotalColumns As Integer
iTotalColumns = ActiveSheet.UsedRange.Columns.Count
Range(Columns(1), Columns(iTotalColumns \ 2)).Select
End Sub



--
Hope that helps.

Vergel Adriano


"Battykoda" wrote:

Good Morning to you all.

Little question here today. I got a worksheet that the lenght can change for
month to month. All i need is to select only half the column in a macro. So
far i found how to make my macro select all of them, and it's no good.

Any suggestion?


Batty



Norman Jones

Select Half a Worksheet
 
Hi Batty,

Try something like:

'=============
Public Sub Tester()
Dim Rng As Range
Dim i As Long

Set Rng = Range("A1").CurrentRegion
i = Rng.Columns.Count

Rng.Resize(, Int(i / 2)).Select

End Sub
'<<==========


---
Regards,
Norman




"Battykoda" <u33810@uwe wrote in message news:717a47408858c@uwe...
There we go.

Let's say that right now, my worsheet that has 130 column. I need to be
able
to get only 75 column of that. The point is, my report will expand every
month, so i want my macro to select half instead of just going to column
75.

After that, i have a serie of treatment that are going to be applied to
that
half... but... right now... im stuck with the selection.

Clearer that way? (It is so clear in my mind... if only excel could get
that!!
!)

Batty

Norman Jones wrote:
Hi Batty,

could you elboarate on what you mean by 'half the column'

---
Regards,
Norman

Good Morning to you all.

[quoted text clipped - 7 lines]

Batty





Battykoda

Select Half a Worksheet
 
Thanks Vergel, thats exactly what i was looking for!!!!

Batty!!!


Vergel Adriano wrote:
like this?

Sub Test()
Dim iTotalColumns As Integer
iTotalColumns = ActiveSheet.UsedRange.Columns.Count
Range(Columns(1), Columns(iTotalColumns \ 2)).Select
End Sub

Good Morning to you all.

[quoted text clipped - 5 lines]

Batty




All times are GMT +1. The time now is 07:03 AM.

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