Excel Formula or Macro

  [email protected]© 18:53 27 Jan 2009
Locked

Is there a Formula or Macro that will do the following.

Look at A1 and B1 and put the values in another spreadsheet the amount of times that it says in C1!

For example if 1234 is in A1 and 5678 is in B1 and 34 is in C1 I want that put in a seperate sheet 34 times and so on with the values in A2 and B2 and C2 etc etc...

I hope it makes sense!!

  VoG II 19:43 27 Jan 2009

Try this - change the sheet names to suit; I used Sheet1 as the source and Sheet2 as the destination


Sub Daz()
Dim LR As Long, i As Long, j As Long
j = 1
With Sheets("Sheet1")
LR = .Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
Sheets("Sheet2").Range("A" & j & ":A" & j + .Range("C" & i).Value - 1) = .Range("A" & i).Value
Sheets("Sheet2").Range("B" & j & ":B" & j + .Range("C" & i).Value - 1) = .Range("B" & i).Value
j = j + .Range("C" & i).Value
Next i
End With
End Sub

  [email protected]© 19:47 27 Jan 2009

I have to say that was superb! Thanks very much.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Dell XPS 13 9370 (2018) review

No need to scan sketches into your computer with Moleskine's new smart pen

WWDC history: Apple's product launches since 2005

Comment importer des contacts d’un iPhone à un autre iPhone ?