Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I need to loop some formatting Code based on a count of rows at the beginning, My data starts at A8 and includes columns B and C, But the number of rows may vary that dat is printed in to. What needs to happen is that after i have all the data i need to add 2 blank lines after each line of data and then format the 3 lines (1 x Data and 2 x Blank) to merge and centre this needs to happen for each line of data. Below is the code i am using that formats the first line correctly but i can't automate it to repeat for other lines. PLEASE HELP i am miles out of my depth, every attempt i make gets me stuck in an infinite loop Sheets("CashFlow").Activate ActiveSheet.Range("9:9").Select Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove ActiveSheet.Range("9:9").Select Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove ActiveSheet.Range("A8:A10").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With ActiveSheet.Range("B8:B10").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With ActiveSheet.Range("C8:C10").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count cells based upon criteria in other cells | Excel Worksheet Functions | |||
Count of Cells Based on Format | Excel Discussion (Misc queries) | |||
Loop through worksheets & empty cells based on color | Excel Programming | |||
Count cells based on value in a range | Excel Discussion (Misc queries) | |||
A loop to merge cells based on a value | Excel Programming |