Thread: copy value
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Myriam Myriam is offline
external usenet poster
 
Posts: 97
Default copy value

Thanks, Dave and Tom. You're both awsome! It's exactly what I needed.
Regards,

"Tom Ogilvy" wrote:

Sub DupData()
Dim rng as Range, cell as Range
With Worksheets("Sheet1")
set rng = .Range(.Cells(1,1),.Cells(1,1).End(xldown))
End With
for each cell in rng
cell.offset(0,2).Resize(1,cell.offset(0,1).Value). Value = cell.Value
Next
End Sub

--
Regards,
Tom Ogilvy

"Myriam" wrote in message
...
I have a sheet of values in column A. In column B I have a number that
indicates how many times the value of A should be copied to the adjacent
cells.
A B C D E F G
120 1 120
240 2 240 240
350 5 350 350 350 350 350
460 3 460 460 460

Could you please point me in the right direction on how to accomplish
this?
Thanks for your help.
Regards,