We help IT Professionals succeed at work.

Copy multiple Data

Cartillo
Cartillo used Ask the Experts™
on
Hi Experts,

I would like to request Experts help to add additional feature in the attached macro. The existing macro able to copy data from booking sheet into “Order” sheet according to date, time and frequency that was entered at the “Booking” sheet. How to prevent the new data was not override the old data if the new data(data from cell C5-Booking sheet) need to copy on the same data and time? Hope Experts will help to add this feature.



Sub spreaddata()
With Sheets("Booking")
    sdat = CVDate(.[c7])
    edat = CVDate(.[e7])
    stim = CVDate(.[c9])
    etim = CVDate(.[e9])
    ndays = edat - sdat + 1
    'dur = (etim - stim) * ndays
    dur = (etim - stim - 0.00001) * ndays
    ns = .[c11]
    Gap = dur / (ns - 1)
End With
dat = sdat
tim = stim
For sh = 1 To ns
    cn = Sheets("Order").Range("2:2").Find(dat).Column
    rn = (tim - 0.25) * 24 * 6 + 3
    Sheets("Order").Cells(rn, cn) = Sheets("Booking").[c5]
    If tim + Gap > etim Then
    dat = dat + 1
    tim = tim + Gap - etim + stim
    Else
    tim = tim + Gap
    End If
Next sh
End Sub

Open in new window

OrderList.xlsm
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Analyst Assistant
Commented:
Do you mean you want to add the new booking even if there is an existing booking?

This wil add the new Title from the booking under any existing data:

Sheets("Order").Cells(rn, cn) = Sheets("Order").Cells(rn, cn) & vbCrlf & Sheets("Booking").[c5]

Author

Commented:
Thanks a lot for the solution

Author

Commented:
Hi imnorie,

Hope you will consider this request, referring to the same workbook.

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_27242075.html