if(cell(SelLeft,SelTop) == ""){ MessageBox("初期値が入力されていません。\n終了します。(#0000)\n","エラー",MB_OK); return; } // 念のため… moveto(SelLeft,SelTop); // ------------------------------------------------------------------- // 条件の入力 // ------------------------------------------------------------------- // 入力する範囲の選択 direction = InputBox("範囲は? (1:行,2:列)\n","範囲の選択",1); if(direction != 1 && direction != 2){ MessageBox("不正な入力値です。(#0001)\n","エラー",MB_OK); return; } // 計算方法の選択 type = InputBox("種類は? (1:加算,2:乗算)\n","種類の選択",1); if(type != 1 && type != 2 ){ MessageBox("不正な入力値です。(#0002)\n","エラー",MB_OK); return; } // 増分値の入力 parameter = InputBox("増分値は? (0より大きい数値を入力)\n","増分値の入力",1); if(parameter <= 0){ MessageBox("不正な入力値です。(#0003)\n","エラー",MB_OK); return; }else if(type == 2 && parameter == 1){ MessageBox("不正な入力値です。(#0004)\n","エラー",MB_OK); return; } // 停止値の入力 stop = InputBox("停止値は?\n","停止値の入力",100); if(stop <= cell(SelLeft,SelTop)){ MessageBox("不正な入力値です。(#0005)\n","エラー",MB_OK); return; } // 最終確認 if(MessageBox("以下の条件で実行しますか?\n\n" + " 範囲: " + direction + " (1:行,2:列)\n" + " 種類: " + type + " (1:加算,2:乗算)\n" + " 増分値: " + parameter + "\n" + " 停止値: " + stop + "\n","実行の確認",MB_OKCANCEL) == IDCANCEL){ return; } // ------------------------------------------------------------------- // 計算開始 // ------------------------------------------------------------------- // 文字列と認識されないようにおまじない(-0) n = cell(Col,Row) - 0; parameter = parameter - 0; if(direction == 1 && type == 1){ while(1){ move(1,0); n = n + parameter; if(n > stop){ return; } cell(Col,Row) = n; } }else if(direction == 2 && type == 1){ while(1){ move(0,1); n = n + parameter; if(n > stop){ return; } cell(Col,Row) = n; } }else if(direction == 1 && type == 2){ while(1){ move(1,0); n = n * parameter; if(n > stop){ return; } cell(Col,Row) = n; } }else if(direction == 2 && type == 2){ while(1){ move(0,1); n = n * parameter; if(n > stop){ return; } cell(Col,Row) = n; } }