         let count = DBmethod().DBRecordCount(ShiftImportHistoryDB)-1
         
         if(DBmethod().DBRecordCount(ShiftImportHistoryDB) != 0){
-            for(var i = 0; i <= count; i++){
+            for i in 0 ... count{
                 if(appDelegate.selectedcell[i]){
                     let historydate = DBmethod().ShiftImportHistoryDBGet()[count-i].date
                     let historyname = DBmethod().ShiftImportHistoryDBGet()[count-i].name

        selectedCells.removeAll()
        
        if(DBmethod().DBRecordCount(ShiftImportHistoryDB) != 0){
            for(var i = DBmethod().DBRecordCount(ShiftImportHistoryDB)-1; i >= 0; i--){
                let historydate = DBmethod().ShiftImportHistoryDBGet()[i].date
                let historyname = DBmethod().ShiftImportHistoryDBGet()[i].name
                shiftlist.append(historydate + "   " + historyname)

    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        var count = 0
        
        for i in 0 ..< appDelegate.selectedcell.count{
            if(appDelegate.selectedcell[i] == true){
                count += 1
            }
        }
        return count
