Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
My Data starts at A8:C500 i have a count to find exact number of lines. myCount = Selection.Rows.Count this works fine. Now i need to the insert 2 blank lines under the first line and then merge and center Column A and then do the same for B and C, i can do this once but i require to repeat this for the amount of the myCount. Below is a sort psuedo code for it that is foresee. Count Rows at begining insert 2 lines Center and merge colums A,B and C for the three lines(1 data and 2 blank) Repeat for line two of Data(which is now at A4 instead of A2 since the insert) until Count of rows = 0 Please help!!!!!! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try following macro:
Sub InsertLinesAndMergeCells() Cells(1, 1).Select k = 1 For i = 1 To 65536 Selection.Offset(1, 0).Select Selection.EntireRow.Insert Selection.EntireRow.Insert For j = 1 To 3 Range(Cells(k, j), Cells(k + 2, j)).Select Selection.Merge With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom End With Next j k = k + 3 Cells(k, 1).Select If IsEmpty(Cells(k, 1)) = True Then Exit Sub Next i End Sub Regards reklamo " wrote: Hi My Data starts at A8:C500 i have a count to find exact number of lines. myCount = Selection.Rows.Count this works fine. Now i need to the insert 2 blank lines under the first line and then merge and center Column A and then do the same for B and C, i can do this once but i require to repeat this for the amount of the myCount. Below is a sort psuedo code for it that is foresee. Count Rows at begining insert 2 lines Center and merge colums A,B and C for the three lines(1 data and 2 blank) Repeat for line two of Data(which is now at A4 instead of A2 since the insert) until Count of rows = 0 Please help!!!!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert Variable Number of Rows; With Loop | Excel Worksheet Functions | |||
How do I create a Macro to sort data and insert blank rows & subto | Excel Worksheet Functions | |||
loop to insert rows | Excel Programming | |||
loop to insert rows | Excel Programming | |||
help on insert rows and fill down loop until end | Excel Programming |