         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 historyname = DBmethod().ShiftImportHistoryDBGet()[count-i].name
                     shiftlist.append(historyname)

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

    //表示ボタンを押した時に呼ばれる関数
    @IBAction func TapShowButton(sender: AnyObject) {
        
        for i in 0 ..< selectedCells.count{
            if(selectedCells[i] == true){
                flag = true
                break
