advanced help
per page, with , order by , clip by
Results of 1 - 1 of about 37699 for IF (0.007 sec.)
[[20100318152124]]
#score: 1591
@digest: 7af916d952fc00acad4bedf98a274c79
@id: 48390
@mdate: 2010-03-19T00:56:19Z
@size: 5220
@type: text/plain
#keywords: label4 (80808), yumie (15241), caption (14698), adst (13533), activecell (7924), caost (7748), capst (7620), intersect (7262), ド有 (6789), nothing (3869), ad10 (3685), st2 (3169), ムソ (3133), 。yu (3082), af6 (3049), st1 (3017), adrs (2528), range (1909), ad2 (1908), ソリ (1843), 塩梅 (1831), 弥太 (1672), not (1586), 梅に (1491), ドン (1465), me (1459), ・en (1449), のca (1242), な塩 (1220), 則性 (1172), value (1091), then (1074)
『記述の方法』(yumie)
こんにちは マクロを始めたばかりで、以下の記述でしか出来ません。 他によい記述がありましたら教えて下さい。 If Not Intersect(ActiveCell, Range("B6")) Is Nothing Then Me.Label4.Caption = Range("AD2").Value If Not Intersect(ActiveCell, Range("B10")) Is Nothing Then Me.Label4.Caption = Range("AF6").Value If Not Intersect(ActiveCell, Range("B14")) Is Nothing Then Me.Label4.Caption = Range("AD10").Value If Not Intersect(ActiveCell, Range("B18")) Is Nothing Then Me.Label4.Caption = Range("Z14").Value If Not Intersect(ActiveCell, Range("B22")) Is Nothing Then Me.Label4.Caption = Range("AD18").Value If Not Intersect(ActiveCell, Range("B27")) Is Nothing Then Me.Label4.Caption = Range("AF22").Value If Not Intersect(ActiveCell, Range("B31")) Is Nothing Then Me.Label4.Caption = Range("AD27").Value If Not Intersect(ActiveCell, Range("B35")) Is Nothing Then Me.Label4.Caption = Range("AD31").Value If Not Intersect(ActiveCell, Range("B39")) Is Nothing Then Me.Label4.Caption = Range("AD35").Value If Not Intersect(ActiveCell, Range("B43")) Is Nothing Then Me.Label4.Caption = Range("AF39").Value If Not Intersect(ActiveCell, Range("B47")) Is Nothing Then Me.Label4.Caption = Range("AD43").Value If Not Intersect(ActiveCell, Range("B52")) Is Nothing Then Me.Label4.Caption = Range("AD47").Value If Not Intersect(ActiveCell, Range("B56")) Is Nothing Then Me.Label4.Caption = Range("AD52").Value If Not Intersect(ActiveCell, Range("B60")) Is Nothing Then Me.Label4.Caption = Range("AF56").Value If Not Intersect(ActiveCell, Range("B64")) Is Nothing Then Me.Label4.Caption = Range("AD60").Value If Not Intersect(ActiveCell, Range("B68")) Is Nothing Then Me.Label4.Caption = Range("AF64").Value If Not Intersect(ActiveCell, Range("B72")) Is Nothing Then Me.Label4.Caption = Range("AD68").Value If Not Intersect(ActiveCell, Range("B77")) Is Nothing Then Me.Label4.Caption = Range("AD72").Value If Not Intersect(ActiveCell, Range("B81")) Is Nothing Then Me.Label4.Caption = Range("AD77").Value If Not Intersect(ActiveCell, Range("B85")) Is Nothing Then Me.Label4.Caption = Range("AF81").Value If Not Intersect(ActiveCell, Range("B89")) Is Nothing Then Me.Label4.Caption = Range("AD85").Value If Not Intersect(ActiveCell, Range("B93")) Is Nothing Then Me.Label4.Caption = Range("AD89").Value If Not Intersect(ActiveCell, Range("B97")) Is Nothing Then Me.Label4.Caption = Range("AD93").Value xp 2003 ---- IF Then ... ElseIF でもいいし、 Select Case でもいいし。 Adst = ActiveCell.Address(0,0) IF Adst = "B6" THen CaoSt = Range("AD2").Value ElseIF Adst = "B10" Then CaoSt = Range("AF6").Value ・ ・ End if IF Capst <> "" Then Me.Label4.Caption = Capst End if ////// dim st1 as variant, st2 as variant, ans as variant St1 = Array("B6","B10","B14",・・・・) St2 = Array("AD2","AF6","AD10",・・・・・ Adst = ActiveCell.Address(0,0) ans = application.Match(Adst,St1,0) If not iserror(ans) Then Me.Label4.Caption = range(st2(ans)).value end if とか。 BJ ---- そのデータの拾い方をコード内でどうこうする前に 元データと拾うデータのセルを2列の一覧表にするようにリンクを張って整理してから やってあげるとVlookupでもFindでも簡単に処理できるんだと思います。 見栄え用のシートとデータのシートを分けて考える事をお勧めします。 (momo) ---- 規則性を見出せればこんな塩梅に書く事もでけます。 (弥太郎) '---------------------- i = 2 Do While i < 97 i = i + 4 Select Case i Case 10, 27, 43, 60, 68, 85 adrs = "AF" Case 18 adrs = "Z" Case Else adrs = "AD" End Select If Not Intersect(ActiveCell, Range("B" & i)) Is Nothing Then MsgBox "B" & i & "のCaptionは" & adrs & i - 4 'Me.label4.Caption = Range(adrs & i - 4) Exit Do End If If i = 22 Or i = 47 Or i = 72 Then i = i + 1 Loop ---- BJさん スッキリしたコード有り難うございます。動きました。 momoさん アドバイス有り難うございます。 弥太郎さん コード有り難うございます。 B6:B25は、4行おきになっていますが 次のB27は、5行目にあり、B27:B47は4行おきに そして、B52は、5行目にあり、B52:B72は4行おきに こんな感じの規則性なっています。 B27、B52、B77の時にずれて表示されます。 宜しくお願い致します。yumie ---- Oh!アイムソリー! こんな塩梅に・・・ MsgBox "B" & i & "のCaptionは" & adrs & i - IIf(i = 27 Or i = 52 Or i = 77, 5, 4) 'Me.label4.Caption = Range(adrs & i - IIf(i = 27 Or i = 52 Or i = 77, 5, 4)) (弥太郎) ---- 弥太郎さん DoとCaseの組み合わせ、勉強になります。 IIfは、はじめて見ました。使い方が、わからないので、調べてみます。 本当に有り難うございました。yumie ---- >IIfは、はじめて見ました。使い方が、わからないので、調べてみます。 因みにIIFは、ドンくさいです。 BJ ...
https://www.excel.studio-kazu.jp/wiki/kazuwiki/201003/20100318152124.txt - [detail] - similar
PREV NEXT
Powered by Hyper Estraier 1.4.13, with 97063 documents and 608337 words.

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