Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Conditional formatting only working for half of worksheet | Excel Discussion (Misc queries) | |||
print half of rows on left and other half on right | Excel Discussion (Misc queries) | |||
Can I have the bottom half Worksheet with less columns than Top | Excel Discussion (Misc queries) | |||
Workbook VBA not recognising half the new worksheet!! | Excel Programming | |||
Full Screen With Status Cut Worksheet Tabs in Half | Excel Programming |