advanced help
per page, with , order by , clip by
Results of 1 - 1 of about 37699 for IF (0.008 sec.)
[[20110228200052]]
#score: 1591
@digest: 1b8bff8b2d3769fa306d4d21b1d5a8d6
@id: 53546
@mdate: 2011-02-28T22:17:56Z
@size: 3936
@type: text/plain
#keywords: checkbox7 (14961), checkbox6 (12919), サノ (12773), checkbox5 (11307), ノオ (10586), checkbox4 (8972), スサ (8016), checkbox3 (7303), 行+ (6912), checkbox2 (5696), checkbox1 (3470), クボ (3304), パク (3183), checkbox (2265), 終行 (2145), value (1990), 最終 (1529), ンパ (1364), worksheets (1332), ス1 (1270), ichinose (1239), true (1025), トメ (927), ラミ (905), ボッ (892), チェ (835), then (787), range (786), ェッ (756), g0 (740), クス (716), 体例 (655)
『チェックボックスのコードをコンパクトにしたいです』(スサノオ)
Excel2003 お世話になります。 チェックボックスのコードを本をお手本に作成しましたが もっとコンパクトに記述する方法がありましたら アドバイスをよろしくお願いします。 If CheckBox1.Value = True Then Worksheets("aa").Range("G14").Value = "1" End If If CheckBox2.Value = True Then Worksheets("aa").Range("H14").Value = "1" End If If CheckBox3.Value = True Then Worksheets("aa").Range("I14").Value = "1" End If If CheckBox4.Value = True Then Worksheets("aa").Range("J14").Value = "1" End If If CheckBox5.Value = True Then Worksheets("aa").Range("K14").Value = "1" End If If CheckBox6.Value = True Then Worksheets("aa").Range("L14").Value = "1" End If If CheckBox7.Value = True Then Worksheets("aa").Range("M14").Value = "1" End If ---- 一例ですが、 With Worksheets("aa") If CheckBox1.Value = True Then .Range("G14").Value = "1" If CheckBox2.Value = True Then .Range("H14").Value = "1" If CheckBox3.Value = True Then .Range("I14").Value = "1" If CheckBox4.Value = True Then .Range("J14").Value = "1" If CheckBox5.Value = True Then .Range("K14").Value = "1" If CheckBox6.Value = True Then .Range("L14").Value = "1" If CheckBox7.Value = True Then .Range("M14").Value = "1" End With (純丸)(o^-')b ---- ここでいうチェックボックスは、どこに配置したそれですか? ユーザーフォームですか? シートにですか? それによって、コードの記述方法が違ってくる場合があります。 ユーザーフォームに貼り付けられたそれなら、 Dim g0 As Long With Worksheets("aa") For g0 = 1 To 7 If Controls("checkbox" & g0).Value Then .Cells(14, g0 + 6).Value = "1" End If Next End With 当該シートに貼り付けられたものなら、 Dim g0 As Long With Me For g0 = 1 To 7 If .OLEObjects("checkbox" & g0).Object.Value Then .Cells(14, g0 + 6).Value = "1" End If Next End With こんなコードになりますね!! 記述をしっかりする事が大事ですよ!! ichinose 純丸 さま 早速ありがとうございました。 アドバイスいただいたコードを少し工夫し最終行を取得しデータを追記していく形にしてみました。 もしおかしいところがありましたらアドバイスよろしくお願いします。 Dim 最終行 As Integer 最終行 = Range("C65536").End(xlUp).Row With Worksheets("リスト") If CheckBox1.Value = True Then .Range("G" & 最終行 + 1).Value = "1" If CheckBox2.Value = True Then .Range("H" & 最終行 + 1).Value = "1" If CheckBox3.Value = True Then .Range("I" & 最終行 + 1).Value = "1" If CheckBox4.Value = True Then .Range("J" & 最終行 + 1).Value = "1" If CheckBox5.Value = True Then .Range("K" & 最終行 + 1).Value = "1" If CheckBox6.Value = True Then .Range("L" & 最終行 + 1).Value = "1" If CheckBox7.Value = True Then .Range("M" & 最終行 + 1).Value = "1" End With ichinose さま かなりコンパクトなコードをありがとうございました。 ちょっと分からない点がありますのでよろしければ教えていただけないでしょうか。 .Cells(14, g0 + 6).Value = "1" の部分で、仮にチェックボックス1〜7個それぞれ、セルに入力する値が異なる場合は どのようにすればよろしいでしょうか? (スサノオ) ---- >仮にチェックボックス1〜7個それぞれ、セルに入力する値が異なる場合はどのようにすればよろしいでしょうか? こういう質問をされるということは、For〜Nextステートメントを使った事がないということですか? だとしたら・・・、 http://journal.mycom.co.jp/articles/2009/07/30/vba/menu.html まず、↑ここでFor文をはじめ、繰り返し処理を行うためのステートメントの 使用方法を学んでください。 ここを読んでまだわからなければ、具体例をあげて再度、投稿してください。 プログラミングをする上で繰り返し処理は要ですから、理解してください それから >ここでいうチェックボックスは、どこに配置したそれですか? これは? ichinose ...
https://www.excel.studio-kazu.jp/wiki/kazuwiki/201102/20110228200052.txt - [detail] - similar
PREV NEXT
Powered by Hyper Estraier 1.4.13, with 97063 documents and 608337 words.

訪問者:カウンタValid HTML 4.01 Transitional