Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Covering Many Columns, why has to be UNION

I am not understanding why this must be a UNION vs just a list of the
columns I want to change the format to make "Currency"

Why can't I just list the columns ~ if is due to limitation of # of
columns, then does anyone know how many columns can be listed.


Union(Range( _

"CG:CG,CI:CI,CK:CK,CM:CM,CO:CO,CQ:CQ,CS:CS,CU:CU,C W:CW,CY:CY,DA:DA,DC:DC,DE:DE,DG:DG,DI:DI,DK:DK,DM: DM,DO:DO,DQ:DQ,DS:DS,DU:DU,DW:DW,DY:DY,J:O,W:W,Y:Y ,AA:AA,AC:AC,AE:AE,AG:AG,AI:AI,AK:AK"
_
), Range( _

"AM:AM,AO:AO,AQ:AQ,AS:AS,AU:AU,AW:AW,AY:AY,BA:BA,B C:BC,BE:BE,BG:BG,BI:BI,BK:BK,BM:BM,BO:BO,BQ:BQ,BS: BS,BU:BU,BW:BW,BY:BY,CA:CA,CC:CC,CE:CE"
_
)).Select
Union(Range( _

"CG:CG,CI:CI,CK:CK,CM:CM,CO:CO,CQ:CQ,CS:CS,CU:CU,C W:CW,CY:CY,DA:DA,DC:DC,DE:DE,DG:DG,DI:DI,DK:DK,DM: DM,DO:DO,DQ:DQ,DS:DS,DU:DU,DW:DW,DY:DY,EA:EA,EC:EC ,EE:EE,EG:EG,EI:EI,EK:EK,EM:EM,EO:EO,EQ:EQ"
_
), Range( _

"ES:ES,EU:EU,J:O,W:W,Y:Y,AA:AA,AC:AC,AE:AE,AG:AG,A I:AI,AK:AK,AM:AM,AO:AO,AQ:AQ,AS:AS,AU:AU,AW:AW,AY: AY,BA:BA,BC:BC,BE:BE,BG:BG,BI:BI,BK:BK,BM:BM,BO:BO ,BQ:BQ,BS:BS,BU:BU,BW:BW,BY:BY,CA:CA"
_
), Range("CC:CC,CE:CE")).Select
Selection.NumberFormat = "$#,##0"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Covering Many Columns, why has to be UNION


Hi,

I hope I understand what you want.

Here 2 methods:

1-Sub ArrayCol: First create an arrays, load the list, then loop
through the list.

2-Sub ColJumpOne: Looks like your want every second columns to be
affected. You can use a simple For Next step 2 then start on the colum
(CG = 85)



Code:
--------------------
Sub ArrayCol()
Dim x As Integer
Dim c As Variant

c = Array("CG:CG", "CI:CI", "CK:CK", "CM:CM", "CO:CO", "CQ:CQ", "CS:CS", "CU:CU")

For x = 0 To UBound(c)
Range(c(x)).NumberFormat = "$#,##0"
Next x
End Sub

Sub ColJumpOne()
Dim x As Integer

For x = 85 To 260 Step 2
Columns(x).NumberFormat = "$#,##0"
Next x
End Sub
--------------------


Charles C
'Opener Consulting Home' (http://www.openerconsulting.com)


Lor;187879 Wrote:
I am not understanding why this must be a UNION vs just a list of the
columns I want to change the format to make "Currency"

Why can't I just list the columns ~ if is due to limitation of # of
columns, then does anyone know how many columns can be listed.


Union(Range( _

"CG:CG,CI:CI,CK:CK,CM:CM,CO:CO,CQ:CQ,CS:CS,CU:CU,C W:CW,CY:CY,DA:DA,DC:DC,DE:DE,DG:DG,DI:DI,DK:DK,DM: DM,DO:DO,DQ:DQ,DS:DS,DU:DU,DW:DW,DY:DY,J:O,W:W,Y:Y ,AA:AA,AC:AC,AE:AE,AG:AG,AI:AI,AK:AK"
_
), Range( _

"AM:AM,AO:AO,AQ:AQ,AS:AS,AU:AU,AW:AW,AY:AY,BA:BA,B C:BC,BE:BE,BG:BG,BI:BI,BK:BK,BM:BM,BO:BO,BQ:BQ,BS: BS,BU:BU,BW:BW,BY:BY,CA:CA,CC:CC,CE:CE"
_
)).Select
Union(Range( _

"CG:CG,CI:CI,CK:CK,CM:CM,CO:CO,CQ:CQ,CS:CS,CU:CU,C W:CW,CY:CY,DA:DA,DC:DC,DE:DE,DG:DG,DI:DI,DK:DK,DM: DM,DO:DO,DQ:DQ,DS:DS,DU:DU,DW:DW,DY:DY,EA:EA,EC:EC ,EE:EE,EG:EG,EI:EI,EK:EK,EM:EM,EO:EO,EQ:EQ"
_
), Range( _

"ES:ES,EU:EU,J:O,W:W,Y:Y,AA:AA,AC:AC,AE:AE,AG:AG,A I:AI,AK:AK,AM:AM,AO:AO,AQ:AQ,AS:AS,AU:AU,AW:AW,AY: AY,BA:BA,BC:BC,BE:BE,BG:BG,BI:BI,BK:BK,BM:BM,BO:BO ,BQ:BQ,BS:BS,BU:BU,BW:BW,BY:BY,CA:CA"
_
), Range("CC:CC,CE:CE")).Select
Selection.NumberFormat = "$#,##0"



--
Charles C
------------------------------------------------------------------------
Charles C's Profile: http://www.thecodecage.com/forumz/member.php?userid=89
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=51821

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Macro Covering Many Columns, why has to be UNION

I am not understanding why this must be a UNION vs just a list of the
columns I want to change the format to make "Currency"



Hi. I can't tell because if works fine with Excel 2007.
There may be a limit of 30 arguments in earlier versions, although I am
not sure of that.

Would this general idea work?

Sub Demo()
Dim C As Long '(C)olumn
Dim s, e 'Start & End
Const fm As String = "$#,##0"

[J:O].NumberFormat = fm
With [W:DY]
s = .Columns(1).Column
e = s + .Columns.Count - 1
End With

For C = s To e Step 2
Columns(C).NumberFormat = fm
Next C
End Sub

= = =
HTH
Dana DeLouis



Lor wrote:
I am not understanding why this must be a UNION vs just a list of the
columns I want to change the format to make "Currency"

Why can't I just list the columns ~ if is due to limitation of # of
columns, then does anyone know how many columns can be listed.


Union(Range( _

"CG:CG,CI:CI,CK:CK,CM:CM,CO:CO,CQ:CQ,CS:CS,CU:CU,C W:CW,CY:CY,DA:DA,DC:DC,DE:DE,DG:DG,DI:DI,DK:DK,DM: DM,DO:DO,DQ:DQ,DS:DS,DU:DU,DW:DW,DY:DY,J:O,W:W,Y:Y ,AA:AA,AC:AC,AE:AE,AG:AG,AI:AI,AK:AK"
_
), Range( _

"AM:AM,AO:AO,AQ:AQ,AS:AS,AU:AU,AW:AW,AY:AY,BA:BA,B C:BC,BE:BE,BG:BG,BI:BI,BK:BK,BM:BM,BO:BO,BQ:BQ,BS: BS,BU:BU,BW:BW,BY:BY,CA:CA,CC:CC,CE:CE"
_
)).Select
Union(Range( _

"CG:CG,CI:CI,CK:CK,CM:CM,CO:CO,CQ:CQ,CS:CS,CU:CU,C W:CW,CY:CY,DA:DA,DC:DC,DE:DE,DG:DG,DI:DI,DK:DK,DM: DM,DO:DO,DQ:DQ,DS:DS,DU:DU,DW:DW,DY:DY,EA:EA,EC:EC ,EE:EE,EG:EG,EI:EI,EK:EK,EM:EM,EO:EO,EQ:EQ"
_
), Range( _

"ES:ES,EU:EU,J:O,W:W,Y:Y,AA:AA,AC:AC,AE:AE,AG:AG,A I:AI,AK:AK,AM:AM,AO:AO,AQ:AQ,AS:AS,AU:AU,AW:AW,AY: AY,BA:BA,BC:BC,BE:BE,BG:BG,BI:BI,BK:BK,BM:BM,BO:BO ,BQ:BQ,BS:BS,BU:BU,BW:BW,BY:BY,CA:CA"
_
), Range("CC:CC,CE:CE")).Select
Selection.NumberFormat = "$#,##0"

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax for a macro to unprotect a union of cells Roy Peck Excel Programming 4 March 11th 07 06:42 PM
Text covering an area Arne Hegefors Excel Discussion (Misc queries) 1 January 9th 07 11:16 AM
add information on the background, w/o covering data? jaggie910 Excel Discussion (Misc queries) 1 March 9th 06 01:06 PM
how do I write a macro covering a workbooks with over 40 sheets kellys Excel Programming 0 January 25th 06 09:03 PM
covering cells Ulf Liljensten Excel Programming 5 February 12th 04 10:38 AM


All times are GMT +1. The time now is 11:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"