ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Long Strings (https://www.excelbanter.com/excel-programming/379218-re-long-strings.html)

PapaDos

Long Strings
 
I didn't analyse your whole range, but it looks like this may be equivalent:

With Range("(1:4,22:25,43:46,64:67,85:88,106:109,127:13 0)
(a:f,g:l,m:r,s:x)")
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With

--
Regards,
Luc.

"Festina Lente"


"Donna C" wrote:

I am pretty new to this VB programming stuff and I am having some problems.I
am trying to merge cells across a wide selection of cells on a work sheet. It
worked fine when on a single line (column A:F for example) however the
scrolling issue came in.I tried to concatenate and combine things however
something is amiss. Its probably something simple but I can't see it.Any
suggestions would be great.Heres what I've got.
Range("A1:F1,A2:F2,A3:F3,A4:F4,A22:F22,A23:F23,A24 :F24,A25:F25,A43:F43" & _
"
A44:F44,A45:F45,A46:F46,A64:F64,A65:F65,A66:F66,A6 7:F67,A85:F85,A86:F86" & _
" A87:F87,A88:F88,A106:F106,A107:F107,A108:F108,A109 :F109" & _
" A127:F127,A128:F128,A129:F129,A130:F130" & _
" G1:L1,G2:L2,G3:L3,G4:L4,G22:L22,G23:L23,G24:L24,G2 5:L25" & _
" G43:L43,G44:L44,G45:L45,G46:L46,G64:L64,G65:L65,G6 6:L66" & _
" G67:L67,G85:L85,G86:L86,G87:L87,G88:L88,G106:L106" & _
"
G107:L107,G108:L108,G109:L109,G127:L127,G128:L128, G129:L129,G130:L130" & _
" M1:R1,M2:R2,M3:R3,M4:R4,M22:R22,M23:R23,M24:R24,M2 5:R25,M43:R43" & _
" M44:R44,M45:R45,M46:R46,M64:R64,M65:R65,M66:R66,M6 7:R67,M85:R85" & _
" M86:R86,M87:R87,M88:R88,M106:R106,M107:R107,M108:R 108,M109:R109" & _
" M127:R127,M128:R128,M129:R129,M130:R130" & _
" S1:X1,S2:X2,S3:X3,S4:X4,S22:X22,S23:X23,S24:X24,S2 5:X25" & _
" S43:X43,S44:X44,S45:X45,S46:X46,S64:X64,S65:X65,S6 6:X66" & _
" S67:X67,S85:X85,S86:X86,S87:X87,S88:X88,S106:X106, S107:X107" & _
" S108:X108,S109:X109,S127:X127,S128:X128,S129:X129, S130:X130").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Thanks in advance
Donna C.


PapaDos

Long Strings
 
NOTE:
There is a space between ")" and "(" in the string.
It is important, since it is the intersection operator...

--
Regards,
Luc.

"Festina Lente"


"PapaDos" wrote:

I didn't analyse your whole range, but it looks like this may be equivalent:

With Range("(1:4,22:25,43:46,64:67,85:88,106:109,127:13 0)
(a:f,g:l,m:r,s:x)")
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With

--
Regards,
Luc.

"Festina Lente"


"Donna C" wrote:

I am pretty new to this VB programming stuff and I am having some problems.I
am trying to merge cells across a wide selection of cells on a work sheet. It
worked fine when on a single line (column A:F for example) however the
scrolling issue came in.I tried to concatenate and combine things however
something is amiss. Its probably something simple but I can't see it.Any
suggestions would be great.Heres what I've got.
Range("A1:F1,A2:F2,A3:F3,A4:F4,A22:F22,A23:F23,A24 :F24,A25:F25,A43:F43" & _
"
A44:F44,A45:F45,A46:F46,A64:F64,A65:F65,A66:F66,A6 7:F67,A85:F85,A86:F86" & _
" A87:F87,A88:F88,A106:F106,A107:F107,A108:F108,A109 :F109" & _
" A127:F127,A128:F128,A129:F129,A130:F130" & _
" G1:L1,G2:L2,G3:L3,G4:L4,G22:L22,G23:L23,G24:L24,G2 5:L25" & _
" G43:L43,G44:L44,G45:L45,G46:L46,G64:L64,G65:L65,G6 6:L66" & _
" G67:L67,G85:L85,G86:L86,G87:L87,G88:L88,G106:L106" & _
"
G107:L107,G108:L108,G109:L109,G127:L127,G128:L128, G129:L129,G130:L130" & _
" M1:R1,M2:R2,M3:R3,M4:R4,M22:R22,M23:R23,M24:R24,M2 5:R25,M43:R43" & _
" M44:R44,M45:R45,M46:R46,M64:R64,M65:R65,M66:R66,M6 7:R67,M85:R85" & _
" M86:R86,M87:R87,M88:R88,M106:R106,M107:R107,M108:R 108,M109:R109" & _
" M127:R127,M128:R128,M129:R129,M130:R130" & _
" S1:X1,S2:X2,S3:X3,S4:X4,S22:X22,S23:X23,S24:X24,S2 5:X25" & _
" S43:X43,S44:X44,S45:X45,S46:X46,S64:X64,S65:X65,S6 6:X66" & _
" S67:X67,S85:X85,S86:X86,S87:X87,S88:X88,S106:X106, S107:X107" & _
" S108:X108,S109:X109,S127:X127,S128:X128,S129:X129, S130:X130").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Thanks in advance
Donna C.


Dave Peterson

Long Strings
 
I bet you wanted to use:

With Intersect(Range("1:4,22:25,43:46,64:67,85:88,106:1 09,127:130"), _
Range("a:f,g:l,m:r,s:x"))

But that treats A:L as one giant cell (since there isn't a gap between columns).

PapaDos wrote:

I didn't analyse your whole range, but it looks like this may be equivalent:

With Range("(1:4,22:25,43:46,64:67,85:88,106:109,127:13 0)
(a:f,g:l,m:r,s:x)")
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With

--
Regards,
Luc.

"Festina Lente"

"Donna C" wrote:

I am pretty new to this VB programming stuff and I am having some problems.I
am trying to merge cells across a wide selection of cells on a work sheet. It
worked fine when on a single line (column A:F for example) however the
scrolling issue came in.I tried to concatenate and combine things however
something is amiss. Its probably something simple but I can't see it.Any
suggestions would be great.Heres what I've got.
Range("A1:F1,A2:F2,A3:F3,A4:F4,A22:F22,A23:F23,A24 :F24,A25:F25,A43:F43" & _
"
A44:F44,A45:F45,A46:F46,A64:F64,A65:F65,A66:F66,A6 7:F67,A85:F85,A86:F86" & _
" A87:F87,A88:F88,A106:F106,A107:F107,A108:F108,A109 :F109" & _
" A127:F127,A128:F128,A129:F129,A130:F130" & _
" G1:L1,G2:L2,G3:L3,G4:L4,G22:L22,G23:L23,G24:L24,G2 5:L25" & _
" G43:L43,G44:L44,G45:L45,G46:L46,G64:L64,G65:L65,G6 6:L66" & _
" G67:L67,G85:L85,G86:L86,G87:L87,G88:L88,G106:L106" & _
"
G107:L107,G108:L108,G109:L109,G127:L127,G128:L128, G129:L129,G130:L130" & _
" M1:R1,M2:R2,M3:R3,M4:R4,M22:R22,M23:R23,M24:R24,M2 5:R25,M43:R43" & _
" M44:R44,M45:R45,M46:R46,M64:R64,M65:R65,M66:R66,M6 7:R67,M85:R85" & _
" M86:R86,M87:R87,M88:R88,M106:R106,M107:R107,M108:R 108,M109:R109" & _
" M127:R127,M128:R128,M129:R129,M130:R130" & _
" S1:X1,S2:X2,S3:X3,S4:X4,S22:X22,S23:X23,S24:X24,S2 5:X25" & _
" S43:X43,S44:X44,S45:X45,S46:X46,S64:X64,S65:X65,S6 6:X66" & _
" S67:X67,S85:X85,S86:X86,S87:X87,S88:X88,S106:X106, S107:X107" & _
" S108:X108,S109:X109,S127:X127,S128:X128,S129:X129, S130:X130").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Thanks in advance
Donna C.


--

Dave Peterson

PapaDos

Long Strings
 
LOL
No, but I made a mistake.
This one should work better:

With
Range("(1:1,2:2,3:3,4:4,22:22,23:23,24:24,25:25,43 :43,44:44,45:45,46:46,64:64,65:65,66:66,67:67,85:8 5,86:86,87:87,88:88,106:106,107:107,108:108,109:10 9,127:127,128:128,129:129,130:130) (a:f,g:l,m:r,s:x)")

The Excel intersection operator (space) works differently than the VBA
Intersect method...

--
Regards,
Luc.

"Festina Lente"


"Dave Peterson" wrote:

I bet you wanted to use:

With Intersect(Range("1:4,22:25,43:46,64:67,85:88,106:1 09,127:130"), _
Range("a:f,g:l,m:r,s:x"))

But that treats A:L as one giant cell (since there isn't a gap between columns).

PapaDos wrote:

I didn't analyse your whole range, but it looks like this may be equivalent:

With Range("(1:4,22:25,43:46,64:67,85:88,106:109,127:13 0)
(a:f,g:l,m:r,s:x)")
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With

--
Regards,
Luc.

"Festina Lente"

"Donna C" wrote:

I am pretty new to this VB programming stuff and I am having some problems.I
am trying to merge cells across a wide selection of cells on a work sheet. It
worked fine when on a single line (column A:F for example) however the
scrolling issue came in.I tried to concatenate and combine things however
something is amiss. Its probably something simple but I can't see it.Any
suggestions would be great.Heres what I've got.
Range("A1:F1,A2:F2,A3:F3,A4:F4,A22:F22,A23:F23,A24 :F24,A25:F25,A43:F43" & _
"
A44:F44,A45:F45,A46:F46,A64:F64,A65:F65,A66:F66,A6 7:F67,A85:F85,A86:F86" & _
" A87:F87,A88:F88,A106:F106,A107:F107,A108:F108,A109 :F109" & _
" A127:F127,A128:F128,A129:F129,A130:F130" & _
" G1:L1,G2:L2,G3:L3,G4:L4,G22:L22,G23:L23,G24:L24,G2 5:L25" & _
" G43:L43,G44:L44,G45:L45,G46:L46,G64:L64,G65:L65,G6 6:L66" & _
" G67:L67,G85:L85,G86:L86,G87:L87,G88:L88,G106:L106" & _
"
G107:L107,G108:L108,G109:L109,G127:L127,G128:L128, G129:L129,G130:L130" & _
" M1:R1,M2:R2,M3:R3,M4:R4,M22:R22,M23:R23,M24:R24,M2 5:R25,M43:R43" & _
" M44:R44,M45:R45,M46:R46,M64:R64,M65:R65,M66:R66,M6 7:R67,M85:R85" & _
" M86:R86,M87:R87,M88:R88,M106:R106,M107:R107,M108:R 108,M109:R109" & _
" M127:R127,M128:R128,M129:R129,M130:R130" & _
" S1:X1,S2:X2,S3:X3,S4:X4,S22:X22,S23:X23,S24:X24,S2 5:X25" & _
" S43:X43,S44:X44,S45:X45,S46:X46,S64:X64,S65:X65,S6 6:X66" & _
" S67:X67,S85:X85,S86:X86,S87:X87,S88:X88,S106:X106, S107:X107" & _
" S108:X108,S109:X109,S127:X127,S128:X128,S129:X129, S130:X130").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Thanks in advance
Donna C.


--

Dave Peterson



All times are GMT +1. The time now is 10:56 AM.

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