Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Column-replying macro
Hi all,
I need help with a macro. The macro has to read number N into cell C of current row, insert N-1 rows under that, and copy values in columns A and B. For instance: Befo A B C dataA2 dataB2 3 dataA3 dataB3 1 dataA4 dataB4 5 ... ... .. After: A B C dataA2 dataB2 3 dataA2 dataB2 dataA2 dataB2 dataA3 dataB3 1 dataA4 dataB4 5 dataA4 dataB4 dataA4 dataB4 dataA4 dataB4 dataA4 dataB4 ... ... .. Thanks a lot for help N! Xau |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Column-replying macro
N!,
Sub RowInsertMacroForNXau() Dim myRow As Long Dim Delta As Long Dim i As Integer Delta = 0 For myRow = 1 To Range("C65536").End(xlUp).Row If IsNumeric(Cells(myRow, 3).Value) Then For i = 2 To Cells(myRow + Delta, 3).Value Rows(myRow + 1 + Delta).Insert Cells(myRow + 1 + Delta, 1).Value = Cells(myRow + Delta, 1).Value Cells(myRow + 1 + Delta, 2).Value = Cells(myRow + Delta, 2).Value Next i Delta = Delta + Cells(myRow + Delta, 3).Value - 1 End If Next myRow End Sub HTH, Bernie MS Excel MVP "N! Xau" wrote in message ... Hi all, I need help with a macro. The macro has to read number N into cell C of current row, insert N-1 rows under that, and copy values in columns A and B. For instance: Befo A B C dataA2 dataB2 3 dataA3 dataB3 1 dataA4 dataB4 5 ... ... .. After: A B C dataA2 dataB2 3 dataA2 dataB2 dataA2 dataB2 dataA3 dataB3 1 dataA4 dataB4 5 dataA4 dataB4 dataA4 dataB4 dataA4 dataB4 dataA4 dataB4 ... ... .. Thanks a lot for help N! Xau |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Column-replying macro
"Bernie Deitrick" <deitbe @ consumer dot org wrote in message Sub RowInsertMacroForNXau() [cut] HTH, Bernie MS Excel MVP Thank you very much, it works great! N! Xau |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro decision row, column column.. | Excel Discussion (Misc queries) | |||
Ron DeBruin Macro - Moving Sheet Name from Last Column to Column A | Excel Worksheet Functions | |||
replying with attachements | Excel Worksheet Functions | |||
Macro for column sum | Excel Worksheet Functions | |||
Replying with changes | Excel Discussion (Misc queries) |