Hi anyone,
looking for a bit more help in building my reservation manager, I have managed to add all my properties now & the code below is working fine.
I would now like to take columns C, E, & R including Header (which is on line 7 ) from the ("Reservations") sheet & have data & headers go to a new sheet called ("income") &
appear on Columns A & B, C but again allow me to have data in Columns D onwards that doesn't get cleared when I update the code.
I hope above makes sense, Thanks
looking for a bit more help in building my reservation manager, I have managed to add all my properties now & the code below is working fine.
I would now like to take columns C, E, & R including Header (which is on line 7 ) from the ("Reservations") sheet & have data & headers go to a new sheet called ("income") &
appear on Columns A & B, C but again allow me to have data in Columns D onwards that doesn't get cleared when I update the code.
I hope above makes sense, Thanks
Code:
Sub copyData()
Dim X As Long, IDs As Variant, Props As Variant, RR As Worksheet, IDcells As Range
Set RR = Sheets("Reservations")
IDs = Array("ID001", "ID002", "ID003", "ID004", "ID005", "ID006", "ID007", "ID008", "ID009", "ID010", "ID011", "ID012", "ID013", "ID014", "ID015", "ID017", "ID018", "ID019", "ID020", "ID021", "ID022", "ID023", "ID024", "ID025", "ID026", "ID027", "ID028", "ID029", "ID030", "ID031", "ID032", "ID033", "ID034", "ID035", "ID037", "ID039", "ID040", "ID042")
Props = Array("ID1", "ID2", "ID3", "ID4", "ID5", "ID6", "ID7", "ID8", "ID9", "ID10", "ID11", "ID12", "ID13", "ID14", "ID15", "ID17", "ID18", "ID19", "ID20", "ID21", "ID22", "ID23", "ID24", "ID25", "ID26", "ID27", "ID28", "ID29", "ID30", "ID31", "ID32", "ID33", "ID34", "ID35", "ID37", "ID39", "ID40", "ID42")
For X = LBound(IDs) To UBound(IDs)
Sheets(Props(X)).Columns("A:F").Clear
RR.Columns("D").Replace IDs(X), "#N/A", xlWhole
Set IDcells = Intersect(RR.Columns("D").SpecialCells(xlConstants, xlErrors).EntireRow, RR.Range("A:A,B:B,C:C,G:G,R:R,S:S").EntireColumn)
RR.Columns("D").Replace "#N/A", IDs(X), xlWhole
IDcells.Copy Sheets(Props(X)).Range("A5")
Intersect(RR.Rows(7), RR.Range("A1,B1,C1,G1,R1,S1").EntireColumn).Copy Sheets(Props(X)).Range("A4")
Next
End Sub
[code]