Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting and merging range within numerous rows
I'm trying to write a code that merges cells from column B to L within
that row (i.e. merge B21:L21 all the way to B1120:L1120). My code merges colums BI to BN through all rows (one monster cell). I'm assuming a For-Next loop is the way to go but am certainly having trouble getting the range called correctly. Dim i As Integer For i = 20 To 1120 Range("Bi:Li").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = True End With Next i End Sub I'd greatly appreciate any help. Cheers, Ty |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting and merging range within numerous rows
Dim i As Long
For i = 20 To 1120 Range("B" & i & ":L" & i).Merge Next i But even better is to get them all at once. Range("b20:b1120").Merge across:=True Ty wrote: I'm trying to write a code that merges cells from column B to L within that row (i.e. merge B21:L21 all the way to B1120:L1120). My code merges colums BI to BN through all rows (one monster cell). I'm assuming a For-Next loop is the way to go but am certainly having trouble getting the range called correctly. Dim i As Integer For i = 20 To 1120 Range("Bi:Li").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = True End With Next i End Sub I'd greatly appreciate any help. Cheers, Ty -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Selecting rows within a range | Excel Worksheet Functions | |||
Excel - merging numerous files | Excel Discussion (Misc queries) | |||
Merge data from numerous rows in one column | Excel Discussion (Misc queries) | |||
selecting range of cells - variable # of rows | Excel Programming | |||
Selecting a range composed of current region + 2 rows | Excel Programming |