fumufumu_2006 の回答履歴
- エクセルVBAボタンで条件色指定
お世話になります 都道府県別に訪問者と数量に色を一括に塗りたいのですが(セル) たとえばAボタンBボタンCボタンを3つ作成し Aボタンを押すと東京、大阪は青色に Bボタンは名古屋、札幌を黄色に Cボタンは九州、四国で赤色に |訪問者|数量|場所| |太郎 |1121|大阪| |四郎 |3321|四国| |山田 |3000|札幌| |斉藤 |2000|東京| |無色 |1000|未定| 上記Aボタンを押すと大阪と東京にいる訪問者と数量に青色を塗りたいのです。 Bなら札幌の山田と3000に黄色とセルの色を付けたい 2000列ぐらいあるので一括で希望です。 わかる方ご教授よろしくお願い致します
- textデータをexcelに取り込む
VBA初心者です。 テキストファイルのデータをEXCELに自動取り込みしてcsv形式で保存したいのですが、テキストデータが65536行を超えているのでWorkbooks.OpenTextでは65537行以後が取り込めません。インターネットで調べた方法FileSystemObjectでテキストデータを1行ごとに取り込もうと思ったのですが、「ユーザー定義型が定義されていません」のエラーメッセージが表示されて旨くいきません。FileSystemObjectの使い方が良く解らないので誰か教えてください。 なお、テキストデータは1行に8フィールド有りますので、取り込んだデータはフィールドごとに8列に分けたいのですが、その方法も解りません。 テキストデータサンプル(1行分) 2004/1/5 101 i 10787 10862 10785 10825 726690000 以下に試みた方法を記述します。 Option Explicit Sub READ_TextFile3() Const cnsFILENAME = "D:\Test\test1.txt" Dim FSO As New FileSystemObject ' FileSystemObject Dim TS As TextStream ' TextStream Dim strREC As String ' 読み込んだレコード内容 Dim GYO As Long ' 収容するセルの行 Set TS = FSO.OpenTextFile(cnsFILENAME, ForReading) GYO = 1 Do Until TS.AtEndOfStream strREC = TS.ReadLine GYO = GYO + 1 Cells(GYO, 1).Value = strREC Loop TS.Close Set TS = Nothing Set FSO = Nothing End Sub
- ベストアンサー
- maikel_y
- Visual Basic
- 回答数3
- excelの関数について
A1からA6のうち、値が全て0であれば「none」と表示し、0以外の値が入っているセルについて「A1,A4,A6」のようにセルの内容を表示したいと思います。 IF関数ではとてつもなく長文になってしまいそうで。 どなたかご教授ください。
- excelの関数について
A1からA6のうち、値が全て0であれば「none」と表示し、0以外の値が入っているセルについて「A1,A4,A6」のようにセルの内容を表示したいと思います。 IF関数ではとてつもなく長文になってしまいそうで。 どなたかご教授ください。
- アクセス2000で作成した処理がアクセス2007で動きません
Access2000で作成した処理が、Access2007でうまく動きません。 どうもテーブルのフィールド名称に全角を使用したことが原因のようです。 私が2000を使用していて、知り合いが2007を使っていますが、2000では問題なく動きます。 フィールド名称を2007でも実行できるように、変更するにはどのようにすればいいのでしょうか。 あまり詳しくなくてすみません。よろしくお願いします。
- プログラムを教えてください。
いろいろ検索をしたりしたのですがわからず 質問というかお願いをさせていただきます。 sheet1のi行のL:R列が全て入力されていた場合切取をし sheet2の最終行へ貼付をする ということをさせたいのですが どのようにマクロを組めばいいのかいまいちわからず 試したのですが何が違うのかわからず前へ進めません。 宜しくお願い致します。 杉崎
- ベストアンサー
- pumifumi
- Visual Basic
- 回答数3
- このマクロを高速化させるにはどうすればいいですか?
VBA初心者で、とりあえず頑張って作ってみました。以下のVBAでの修正点を教えてください。 (英単語の小テスト用につくりました。) Range("C3:E22,H3:J22").Select Selection.Font.ColorIndex = 2 Selection.Interior.ColorIndex = 2 Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone Selection.Borders(xlEdgeLeft).LineStyle = xlNone Selection.Borders(xlEdgeTop).LineStyle = xlNone Selection.Borders(xlEdgeBottom).LineStyle = xlNone Selection.Borders(xlEdgeRight).LineStyle = xlNone Selection.Borders(xlInsideVertical).LineStyle = xlNone Selection.Borders(xlInsideHorizontal).LineStyle = xlNone Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone ' ここまでは、共通の動作 Range("A1").Select ActiveCell.FormulaR1C1 = "20" ' 問題数に応じて、数字を変更 Range("C3:E22,H3:J22").Select With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ' 罫線を引く Range("D3:E22,I3:J22").Select Selection.Font.ColorIndex = 1 ' 文字を黒くする Range("C3:C22,H3:H22").Select Selection.Interior.ColorIndex = 16 ' セルをグレーにする Rows("3:18").Select Selection.RowHeight = 31.5 ' セルの幅を指定 ActiveSheet.PageSetup.PrintArea = "$B$1:$K$25" ' 印刷範囲を指定 Range("U3:U42").Select Selection.ClearContents ' 四線を消去 Range("D3:D4").Select Calculate ' 再計算完了 宜しくお願いします。 また、このVBAは慣れている人から見ると何点くらいですか?(感覚で結構です)
- ベストアンサー
- add0804
- Visual Basic
- 回答数8
- このマクロを高速化させるにはどうすればいいですか?
VBA初心者で、とりあえず頑張って作ってみました。以下のVBAでの修正点を教えてください。 (英単語の小テスト用につくりました。) Range("C3:E22,H3:J22").Select Selection.Font.ColorIndex = 2 Selection.Interior.ColorIndex = 2 Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone Selection.Borders(xlEdgeLeft).LineStyle = xlNone Selection.Borders(xlEdgeTop).LineStyle = xlNone Selection.Borders(xlEdgeBottom).LineStyle = xlNone Selection.Borders(xlEdgeRight).LineStyle = xlNone Selection.Borders(xlInsideVertical).LineStyle = xlNone Selection.Borders(xlInsideHorizontal).LineStyle = xlNone Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone ' ここまでは、共通の動作 Range("A1").Select ActiveCell.FormulaR1C1 = "20" ' 問題数に応じて、数字を変更 Range("C3:E22,H3:J22").Select With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ' 罫線を引く Range("D3:E22,I3:J22").Select Selection.Font.ColorIndex = 1 ' 文字を黒くする Range("C3:C22,H3:H22").Select Selection.Interior.ColorIndex = 16 ' セルをグレーにする Rows("3:18").Select Selection.RowHeight = 31.5 ' セルの幅を指定 ActiveSheet.PageSetup.PrintArea = "$B$1:$K$25" ' 印刷範囲を指定 Range("U3:U42").Select Selection.ClearContents ' 四線を消去 Range("D3:D4").Select Calculate ' 再計算完了 宜しくお願いします。 また、このVBAは慣れている人から見ると何点くらいですか?(感覚で結構です)
- ベストアンサー
- add0804
- Visual Basic
- 回答数8
- デバッグ中に例外が発生した時、プログラムを止めてコードを黄色でマーク表示するには
VB2005 Express EditionにSP1を適用しています。 VBの勉強を始めて3ヶ月ほどになります。 以前に使っていたときは、デバッグ時に例外が発生すると、特に例外処理していない場合はイミディエイトウィンドウに例外のメッセージが表示され、プログラムがストップし、問題があったコードが黄色でマークされて表示されていました。 しかし最近PCをフォーマットして改めてVB2005を入れたところ、ほとんどの場合例外時にプログラムが止まらず、コードが黄色でマークされたりもしなくなってしまいました。ただ、イミディエイトウィンドウに、「'System.ArgumentOutOfRangeException' の初回例外が System.Windows.Forms.dll で発生しました。」などと表示されるだけです。どこで例外が発生したのかわかりにくくなって困っています。場合によってはちゃんとプログラムがとまることもありますが、違いなどもよくわからずにおります。 なにか事前の設定を忘れているのだと思うのですが、どこの設定を変えればよいのか教えてください。よろしくお願いいたします。
- 締切済み
- new_hope
- Visual Basic
- 回答数1
- このマクロを高速化させるにはどうすればいいですか?
VBA初心者で、とりあえず頑張って作ってみました。以下のVBAでの修正点を教えてください。 (英単語の小テスト用につくりました。) Range("C3:E22,H3:J22").Select Selection.Font.ColorIndex = 2 Selection.Interior.ColorIndex = 2 Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone Selection.Borders(xlEdgeLeft).LineStyle = xlNone Selection.Borders(xlEdgeTop).LineStyle = xlNone Selection.Borders(xlEdgeBottom).LineStyle = xlNone Selection.Borders(xlEdgeRight).LineStyle = xlNone Selection.Borders(xlInsideVertical).LineStyle = xlNone Selection.Borders(xlInsideHorizontal).LineStyle = xlNone Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone ' ここまでは、共通の動作 Range("A1").Select ActiveCell.FormulaR1C1 = "20" ' 問題数に応じて、数字を変更 Range("C3:E22,H3:J22").Select With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ' 罫線を引く Range("D3:E22,I3:J22").Select Selection.Font.ColorIndex = 1 ' 文字を黒くする Range("C3:C22,H3:H22").Select Selection.Interior.ColorIndex = 16 ' セルをグレーにする Rows("3:18").Select Selection.RowHeight = 31.5 ' セルの幅を指定 ActiveSheet.PageSetup.PrintArea = "$B$1:$K$25" ' 印刷範囲を指定 Range("U3:U42").Select Selection.ClearContents ' 四線を消去 Range("D3:D4").Select Calculate ' 再計算完了 宜しくお願いします。 また、このVBAは慣れている人から見ると何点くらいですか?(感覚で結構です)
- ベストアンサー
- add0804
- Visual Basic
- 回答数8
- String だと「 ByRef引数の型が一致しません 」というエラーが出ます。なぜ?
ここで「Kaplan-Meyer 生存分析に便利なソフトを教えて」と質問した shuu_01 です。ここで VisualBasic のソースのありかを教えて頂き、自分に使いやすいようソースを書き換えようと奮闘中です(それまで VisualBasic の経験がなく 無謀!と実感中です)。 元々のソースはグラフが1本だけだったので、肺癌だと「腺癌」「扁平上皮癌」「小細胞癌」、、といろんな癌の種類別にグラフを数本 書くのが目標です。そこで、 Sub km_test() Dim nc As Integer, gr() As String nc = 2 ReDim gr(nc) gr(0) = "腺癌" gr(1) = "扁平上皮癌" gr(2) = "小細胞癌" km_group_test nc, gr End Sub Sub km_group_test(nc As Integer, gr As String) End Sub というソースを書くと: String の変数 gr の色が変わり、「 ByRef引数の型が一致しません 」というエラーが出ます。 Integer の変数 nc ではエラーが出ません。 きちんと型を一致させているつもりなのに、なぜ???
- ベストアンサー
- shuu_01
- Visual Basic
- 回答数2
- プログラムを教えてください。
いろいろ検索をしたりしたのですがわからず 質問というかお願いをさせていただきます。 sheet1のi行のL:R列が全て入力されていた場合切取をし sheet2の最終行へ貼付をする ということをさせたいのですが どのようにマクロを組めばいいのかいまいちわからず 試したのですが何が違うのかわからず前へ進めません。 宜しくお願い致します。 杉崎
- ベストアンサー
- pumifumi
- Visual Basic
- 回答数3
- このマクロを高速化させるにはどうすればいいですか?
VBA初心者で、とりあえず頑張って作ってみました。以下のVBAでの修正点を教えてください。 (英単語の小テスト用につくりました。) Range("C3:E22,H3:J22").Select Selection.Font.ColorIndex = 2 Selection.Interior.ColorIndex = 2 Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone Selection.Borders(xlEdgeLeft).LineStyle = xlNone Selection.Borders(xlEdgeTop).LineStyle = xlNone Selection.Borders(xlEdgeBottom).LineStyle = xlNone Selection.Borders(xlEdgeRight).LineStyle = xlNone Selection.Borders(xlInsideVertical).LineStyle = xlNone Selection.Borders(xlInsideHorizontal).LineStyle = xlNone Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone ' ここまでは、共通の動作 Range("A1").Select ActiveCell.FormulaR1C1 = "20" ' 問題数に応じて、数字を変更 Range("C3:E22,H3:J22").Select With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ' 罫線を引く Range("D3:E22,I3:J22").Select Selection.Font.ColorIndex = 1 ' 文字を黒くする Range("C3:C22,H3:H22").Select Selection.Interior.ColorIndex = 16 ' セルをグレーにする Rows("3:18").Select Selection.RowHeight = 31.5 ' セルの幅を指定 ActiveSheet.PageSetup.PrintArea = "$B$1:$K$25" ' 印刷範囲を指定 Range("U3:U42").Select Selection.ClearContents ' 四線を消去 Range("D3:D4").Select Calculate ' 再計算完了 宜しくお願いします。 また、このVBAは慣れている人から見ると何点くらいですか?(感覚で結構です)
- ベストアンサー
- add0804
- Visual Basic
- 回答数8
- このマクロを高速化させるにはどうすればいいですか?
VBA初心者で、とりあえず頑張って作ってみました。以下のVBAでの修正点を教えてください。 (英単語の小テスト用につくりました。) Range("C3:E22,H3:J22").Select Selection.Font.ColorIndex = 2 Selection.Interior.ColorIndex = 2 Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone Selection.Borders(xlEdgeLeft).LineStyle = xlNone Selection.Borders(xlEdgeTop).LineStyle = xlNone Selection.Borders(xlEdgeBottom).LineStyle = xlNone Selection.Borders(xlEdgeRight).LineStyle = xlNone Selection.Borders(xlInsideVertical).LineStyle = xlNone Selection.Borders(xlInsideHorizontal).LineStyle = xlNone Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone ' ここまでは、共通の動作 Range("A1").Select ActiveCell.FormulaR1C1 = "20" ' 問題数に応じて、数字を変更 Range("C3:E22,H3:J22").Select With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ' 罫線を引く Range("D3:E22,I3:J22").Select Selection.Font.ColorIndex = 1 ' 文字を黒くする Range("C3:C22,H3:H22").Select Selection.Interior.ColorIndex = 16 ' セルをグレーにする Rows("3:18").Select Selection.RowHeight = 31.5 ' セルの幅を指定 ActiveSheet.PageSetup.PrintArea = "$B$1:$K$25" ' 印刷範囲を指定 Range("U3:U42").Select Selection.ClearContents ' 四線を消去 Range("D3:D4").Select Calculate ' 再計算完了 宜しくお願いします。 また、このVBAは慣れている人から見ると何点くらいですか?(感覚で結構です)
- ベストアンサー
- add0804
- Visual Basic
- 回答数8
- このマクロを高速化させるにはどうすればいいですか?
VBA初心者で、とりあえず頑張って作ってみました。以下のVBAでの修正点を教えてください。 (英単語の小テスト用につくりました。) Range("C3:E22,H3:J22").Select Selection.Font.ColorIndex = 2 Selection.Interior.ColorIndex = 2 Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone Selection.Borders(xlEdgeLeft).LineStyle = xlNone Selection.Borders(xlEdgeTop).LineStyle = xlNone Selection.Borders(xlEdgeBottom).LineStyle = xlNone Selection.Borders(xlEdgeRight).LineStyle = xlNone Selection.Borders(xlInsideVertical).LineStyle = xlNone Selection.Borders(xlInsideHorizontal).LineStyle = xlNone Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone ' ここまでは、共通の動作 Range("A1").Select ActiveCell.FormulaR1C1 = "20" ' 問題数に応じて、数字を変更 Range("C3:E22,H3:J22").Select With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ' 罫線を引く Range("D3:E22,I3:J22").Select Selection.Font.ColorIndex = 1 ' 文字を黒くする Range("C3:C22,H3:H22").Select Selection.Interior.ColorIndex = 16 ' セルをグレーにする Rows("3:18").Select Selection.RowHeight = 31.5 ' セルの幅を指定 ActiveSheet.PageSetup.PrintArea = "$B$1:$K$25" ' 印刷範囲を指定 Range("U3:U42").Select Selection.ClearContents ' 四線を消去 Range("D3:D4").Select Calculate ' 再計算完了 宜しくお願いします。 また、このVBAは慣れている人から見ると何点くらいですか?(感覚で結構です)
- ベストアンサー
- add0804
- Visual Basic
- 回答数8
- VB 2005 Textbox にフォーカスを移動する。
VB2005でソフト作成中ですが、フォームを開いた時、そのフォーム内にあるTextbox にフォーカスを持って行きたいのですがうまくいきません。フォームロード部分のコードに、Text.Focus()と書いているだけではだめなのでしょうか?どなたかご教授願います。
- 締切済み
- shimakichi
- Visual Basic
- 回答数1
- エクセルシートでハンドカーソルを使う
エクセルシートの任意セル(複数もありえる)にカーソルを持っていくと十字カーソルがハンドカーソルになるようにしたいのです。任意のセルにマクロやリンクを仕掛けるのではなくこのセルに何か仕掛けがありますよというような感じで・・・・・・どなたかお願いします。
- 締切済み
- ma-ma-ne
- Visual Basic
- 回答数2
- 2行をグループ化してソート(金額の大きい順)に編集したい
A 1 あ 2 1,000円 3 い 4 2,000円 上記のエクセルのデータを昇降順に並び替えたいのですが、 セル番地A1とA2はセット、A3とA4はセットで 金額の大きい順に並びかえることはできますか?
- VBA でCSV集計
VBAをはじめて1ヶ月のものです。 VBAの集計ツールを作成していますが 思うようにいかず、お知恵をお借りしたいと考えています。 abcというフォルダ配下に以下のように4桁の日付を示す フォルダが日付毎にあります。(いくつあるかはわかりません。) さらにその配下にいくつかのcsvファイルがおいてありますが aaa.csvというcsvのみ抽出し 最終的には合体.csvのような集計CSVを作成したいと考えています。 以上よろしくお願いいたします。 (1) abc → 0812フォルダ <aaa.csv> A列 B列 C列 1行 100 200 8月12日 2行 100 100 3行 200 200 4行 300 100 5行 100 100 6行 200 200 7行 400 100 8行 100 100 (2)abc → 0813フォルダ <aaa.csv> A列 B列 C列 1行 0 300 8月13日 2行 100 100 3行 100 200 4行 100 200 5行 100 200 6行 300 200 7行 300 400 8行 200 100 ↓ (3)<合体.csv> A列 B列 C列 D列 E列 F列 G列 (日付) (A1~A4計)(A5~A8計)(合体B+C)(B1~B4計)(B5~B8計)(合体E+F) 1行 8月12日 700 800 1500 600 500 1100 2行 8月13日 300 900 1200 800 900 1700
- セルのデータを、ボタンでコピーさせたいのです
初めて質問させていただきます。 エクセル関数はある程度こなせますが、マクロはほとんど初心者です。 どのようにマクロを記述すれば良いか、わからなくて困っています。 A1のセルにコピー元のデータがあります。 この時、A4にあるボタンを押すと、A1のデータがA3にコピーされます。 またある時は、C4にあるボタンを押すと、A1のデータがC3にコピーされます。 またある時は、D4にあるボタンを押すと、A1のデータがD3にコピーされます。 A B C D E ・・・・・・ 1 100 2 3 100 100 100 4 ■ ■ ■ ■ ■ 5 6 7 ・ ・ ・ あるいは、ボタンを一つにして、B1にあるボタンを押すと A1のデータがA3にコピーされます。またある時は、B1にあるボタンを押すと A1のデータがC3にコピーされます。 A B C D E 1 100 ■ 2 3 100 100 4 5 6 コピー先のセルが少数なら、コピー先のセルを"Range"で指定して、各ボタンに割り付ければ済むのですが、入力するセルが何百とある為、これをいちいち各ボタンに割り付けて、マクロを書いて行くのは、気が遠くなる作業になってしまいます。 ボタンは一個でも、何百個あっても構わないのです。 マクロをどのように記述すれば良いでしょうか。 どうか、アドバイスをお願いします。
- ベストアンサー
- buffie
- Visual Basic
- 回答数1