• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Extend value to the right

dgk

Member
Hi
I need a VBA code to do do the following
Put in the value that is in column J (starting from row 5) , to as many column’s to the right (starting from column N) ,as the value in column K indicates.

Please see sample file

In this example there are only 2 items (2 rows) where this needs to be done , but in reality it can be 2 ,10, or even 60 or more

You guys helped me a lot in the past , I hope you can help me now as well

Thanks
 

Attachments

  • SAMPLE TO EXTEND.xlsm
    12.4 KB · Views: 6
Code:
With Sheets("Sheet1")
  For rw = 5 To .Cells(.Rows.Count, "K").End(xlUp).Row
    With .Cells(rw, "K")
      If .Value > 0 Then
        .Offset(, 3).Resize(, .Value) = .Offset(, -1).Value
      End If
    End With
  Next rw
End With
 
it looks pretty good at first glance
just a layman questions
instead of referring to "sheet1" need to refer to open worksheet since it would always have different
names
can you modify this ?

Thanks
 
Back
Top