セルの挿入、削除
データ作成中に個別にセルをどうしても挿入、削除の必要性があります。現行バージョンでできる方法をお知らせください。
iMac, iOS 8.1.3
Apple の脅威の通知と金銭目当てのスパイウェアへの対策について
Apple の脅威の通知と金銭目当てのスパイウェアへの対策についてが公開されました。
Apple の脅威の通知と金銭目当てのスパイウェアへの対策についてが公開されました。
データ作成中に個別にセルをどうしても挿入、削除の必要性があります。現行バージョンでできる方法をお知らせください。
iMac, iOS 8.1.3
失礼致します。 1)行や列の挿入ではなく、EXCELの機能にある、セルを挿入あるいは削除して、セルを左右あるいは上下に移動させるということでしょうか? また、2)『現行バージョン』とのことなのですが、Numbners for Mac (ver. 3.5.2)のことでしょうか? それとも、Numbers for iOS (ver.2.5.2)のことでしょうか?
T22T様
早々のご返事ありがとうございます。
そうです現行バージョンとはNumbners for Mac (ver. 3.5.2)です。
又、ご指摘のとおりEXCELのように逐次セルの挿入削除をしたいです。現状では例えばセル2コマを選択し新たに挿入すると、列そのものが
削除されたり挿入されたりしているようです。
恐れ入りますがさらにの情報を頂ければ幸いに存じます。
現状セル単位での挿入削除はできません。
urichin 様
ご回答ありがとうございます。以前の同様の問答を検索見ましたが、改善されてないのですね。
日常のデーターベース作成をするさいにごく基本的な必要な操作と思ってます。
故、今後に期待します。
改めて、ご教授ありがとうございました。
度々、失礼致します。
1)urichinさんがご指摘の様に、Numbers for Mac ver.3.5 にはExcelと同等の機能(セルを挿入・削除して右・下に移動)が無い状態です。 これはシート中の表の扱いが異なっているからだと思います。Excelのシートは初めから表の行列数を決めない形で数値を入力する仕組みになっているので、セルの挿入・削除の機能が必要になるかもしれないです。
2)Numbers.appの表中の選択したセル範囲はドラッグ&ドロップで移動できますので、キーボードショートカットをうまく使うと数回の操作でセルを挿入・削除して右・下に移動することができると思います。 しかし、表の行列数が大きくなると少し面倒かもしれないです。
3)AppleScriptを使うと通常のコマンドでは操作できない処理も、ある程度可能になります。 また、Automator.appのサービスと組み合わせるとキーボードショートカットでAppleScriptを実行することも可能です。 頻繁にセルの挿入・削除を行う必要がある場合は、AppleScriptを利用することも一つの方法だと思います。 AppleScript.appで利用可能なコマンドはScirptEditor.appのNumbers辞書で確認できます。 セル範囲の挿入・削除・移動、コピーなどを実行可能ですが、現在のヴァージョンでは、一つ一つのセルの値に対して操作する機能しかないので、表の行列数が大きくなると、処理に時間がかかってしまいます。 また、それ以外にも様々な制約がある一方で、機能の追加も可能です。 例えば、以下のAppleScriptでは、選択中のセル範囲に空白のセルを挿入して、残りのセルを右側あるいは、下側に移動します。 セルの値のみを移動するだけで、数式や書式は移動されないなどの制約があります。 ScriptEditor.appにコピーして実行してみてください(Numbers.appを起動して表中のセル範囲を選択した状態で実行します)。
tell document 1 of application "Numbers"
tell active sheet
set theTable to first table whose class of selection range is range
tell theTable
set theRange to selection range
set {nr, nc} to {count of rows, count of columns} of theRange
set {r1, c1} to {address of row, address of column} of first cell of theRange
set {lr, lc} to {address of row, address of column} of last cell of theRange
set cell_A to name of first cell of theRange
set theList to {"Insert cells & shift right", "Insert cells & shift down"}
activate
set theChoice to (choose from list theList) as text
if (theChoice is not "false") then
if theChoice is "Insert cells & shift right" then
set rangeName to cell_A & ":" & (name of last cell of row lr)
set valueList to value of cells of range rangeName
set column count to (column count) + nc
set cell_B to name of cell r1 of column (lc + 1)
set rangeName to cell_B & ":" & (name of last cell of row lr)
set cellList to cells of range rangeName
else if theChoice is "Insert cells & shift down" then
set rangeName to cell_A & ":" & (name of last cell of column lc)
set valueList to value of cells of range rangeName
set row count to (row count) + nr
set cell_C to name of cell (lr + 1) of column c1
set rangeName to cell_C & ":" & (name of last cell of column lc)
set cellList to cells of range rangeName
end if
set value of cells of theRange to ""
repeat with i from 1 to length of cellList
set value of item i of cellList to item i of valueList
end repeat
set selection range to theRange
end if
end tell
end tell
end tell
同様に、選択したセル範囲を削除してセルを左あるいは上に移動するAppleScriptも 以下のものになります。
tell document 1 of application "Numbers"
tell active sheet
set theTable to first table whose class of selection range is range
tell theTable
set theRange to selection range
set {nr, nc} to {count of rows, count of columns} of theRange
set {r1, c1} to {address of row, address of column} of first cell of theRange
set {lr, lc} to {address of row, address of column} of last cell of theRange
set cell_A to name of first cell of theRange
set theList to {"Remove cells & shift left", "Remove cells & shift up"}
activate
set theChoice to (choose from list theList) as text
if (theChoice is not "false") then
if theChoice is "Remove cells & shift left" then
set cell_B to name of cell r1 of column (lc + 1)
set cell_C to name of last cell of row lr
set rangeName to cell_B & ":" & cell_C
set valueList to value of cells of range rangeName
set cell_C to name of cell (column count - nc) of row lr
set rangeName to cell_A & ":" & cell_C
set cellList to cells of range rangeName
set rangeName to cell_A & ":" & name of last cell of row lr
else if theChoice is "Remove cells & shift up" then
set cell_B to name of cell (lr + 1) of column c1
set cell_C to name of last cell of column lc
set rangeName to cell_B & ":" & cell_C
set valueList to value of cells of range rangeName
set cell_C to name of cell (row count - nr) of column lc
set rangeName to cell_A & ":" & cell_C
set cellList to cells of range rangeName
set rangeName to cell_A & ":" & name of last cell of column lc
end if
set value of cells of range rangeName to ""
repeat with i from 1 to length of cellList
set value of item i of cellList to item i of valueList
end repeat
end if
end tell
end tell
end tell
参考になれば幸いです。 参照ページ:AppleScript and Numbers
T22T 様
このたびはご丁寧にありがとうございます。
近々試してみます。
マックは20年使ってますが、毎度感覚的にマニュアルを殆ど読まない、横着はユーザー故、ご教授頂いた事うまく実践できるか、
一抹の不安はありますが、折角の御指南故、努力して行ってみます。
あなた様のような親切な方がいらっしゃいますと本当に助かります。
改めて厚く御礼申し上げます。
セルの挿入、削除