Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro decision row, column column.. MrDave Excel Discussion (Misc queries) 0 August 9th 09 09:42 PM
Ron DeBruin Macro - Moving Sheet Name from Last Column to Column A ScottMSP Excel Worksheet Functions 7 December 12th 08 06:07 PM
replying with attachements John at Work[_2_] Excel Worksheet Functions 4 September 23rd 08 08:06 PM
Macro for column sum Zeepowlee Excel Worksheet Functions 4 June 22nd 06 08:36 PM
Replying with changes faith5134 Excel Discussion (Misc queries) 0 April 12th 06 02:21 PM


All times are GMT +1. The time now is 11:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"