| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1572 人关注过本帖
标题:求大神解释下什么意思
只看楼主 加入收藏
yjk1314920
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2019-4-23
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
求大神解释下什么意思
这是日本人编辑的VBA程序,可以棒忙解释下么?

Sub instruct()

Dim f As Boolean
Dim SRN, ERN As Integer
Dim End_reel_N As Integer
Dim IntColor, IntColorN As Double
Dim i, j, k, l, m, n, c1 As Integer
Dim total_L, accum_L, H2_L As Single
Dim R, RH As Single

Const max_reel_num As Integer = 80

Sheets("instruct").Select

SRN = 12
ERN = SRN + max_reel_num
total_L = Range("H4").Value
End_reel_N = Range("K4").Value
H2_L = Range("AN4")
IntColor = 65535
IntColorN = 12632256

Range("K12:AP91").Select
    Selection.ClearContents
    With Selection.Interior
        .Pattern = xlNone
    End With

'慡儕乕儖應掕丂丂丟丂奜娤,OTDR
For i = 2 To End_reel_N - 1
    j = SRN + i - 1
        
    Range(Cells(j, 11), Cells(j, 13)).Select
    If Cells(j, 9) = 1 Then
        Selection.Interior.color = IntColor
        Selection.Value = 1
      Else
        Selection.Interior.color = IntColorN
        Selection.Value = 0
    End If
        
Next i

'慡儕乕儖應掕丂丂丟丂MFD,Cutoff,PMD     '以下是MFD、CUTOFF、PMD的抽检,每隔4盘抽一盘。
For i = 2 To End_reel_N - 1
    j = SRN + i - 1
        
    c1 = i Mod 5
    If c1 = 1 Then
      If Cells(j, 9) = 1 Then
        Call instruct_1(j, 15, 17, 35, IntColor, 1)   '如果是良品,则黄色显示1.
        
      Else

       Call instruct_1(j, 15, 17, 35, IntColorN, 0)  '如果是不良品,则灰色显示0.

        For k = 1 To j + 10
            If Cells(j - k, 9) = 1 Then

               Call instruct_1(j - k, 15, 17, 35, IntColor, 1)  '判断首盘纤位置。

                Exit For
            End If
        Next k

        For k = 1 To j + 10
            If Cells(j + k, 9) = 1 Then

               Call instruct_1(j + k, 15, 17, 35, IntColor, 1)  '判断末盘纤位置。

                Exit For
            End If
        Next k
      End If
   
    End If
   
Next i
   
'敳偒庢傝5儕乕儖枅丂丂丟丂Dispersion
For i = 2 To End_reel_N - 1
    j = SRN + i - 1
        
    c1 = i Mod 5                                                                '设置每隔4盘测一盘。
    If c1 = 1 Then
      If Cells(j, 9) = 1 Then
        Call instruct_1(j, 19, 21, 23, IntColor, 1)
        
      Else
        
        Call instruct_1(j, 19, 21, 23, IntColorN, 0)
        
        For k = 1 To j + 10
            If Cells(j - k, 9) = 1 Then
               
                Call instruct_1(j - k, 19, 21, 23, IntColor, 1)
               
                Exit For
            End If
        Next k
        
        For k = 1 To j + 10
            If Cells(j + k, 9) = 1 Then
               
                Call instruct_1(j + k, 19, 21, 23, IntColor, 1)
               
                Exit For
            End If
        Next k
      End If
   
    End If
   
Next i
   
   
'慡儕乕儖應掕丂丂丟丂僋儔僢僪宎丄僋儔僢僪旕墌棪丄曃怱検丄慺慄宎     'PK2400抽检程序
For i = 2 To End_reel_N - 1
    j = SRN + i - 1
        
    c1 = i Mod 5
    If c1 = 1 Then
      If Cells(j, 9) = 1 Then
        
        Call instruct_2(j, 25, 27, 29, 31, IntColor, 1)
      
      Else

        Call instruct_2(j, 25, 27, 29, 31, IntColorN, 0)

        For k = 1 To j + 10
            If Cells(j - k, 9) = 1 Then
                Call instruct_2(j - k, 25, 27, 29, 31, IntColor, 1)
                Exit For
            End If
        Next k

        For k = 1 To j + 10
            If Cells(j + k, 9) = 1 Then
                Call instruct_2(j + k, 25, 27, 29, 31, IntColor, 1)
                Exit For
            End If
        Next k
      
      End If
   
    End If
   
Next i


'嵟俙丆俛抂
    c1 = SRN
    Set R1 = Range(Cells(c1, 11), Cells(c1, 36))
    c1 = SRN + End_reel_N - 1
    Set R2 = Range(Cells(c1, 11), Cells(c1, 36))
    Union(R1, R2).Select
    Selection.Interior.color = IntColor
    Selection.Value = 1
   
'悈慺帋尡                                                           'H2氢损抽检。
For i = 2 To End_reel_N - 1
    j = SRN + i - 1

    If Cells(j, 10) >= H2_L Then
      If Cells(j, 9) = 1 And Cells(j, 8) >= 7 Then
        
        Range(Cells(j, 37), Cells(j, 41)).Select
        Selection.Interior.color = IntColor
        Selection.Value = 1
        Exit For
      
      Else
        
        Range(Cells(j, 37), Cells(j, 41)).Select
        Selection.Interior.color = IntColorN
        Selection.Value = 0
        
        For k = 1 To j + 10
            If Cells(j - k, 9) = 1 And Cells(j - k, 8) >= 7 Then
                Range(Cells(j - k, 37), Cells(j - k, 41)).Select
                Selection.Interior.color = IntColor
                Selection.Value = 1
                Exit For
            End If
            
        Next k
        Exit For
      End If
    End If
   
Next i

'For i = 2 To End_reel_N - 1                                         '增加部分。此处开始。
'    j = SRN + i - 1
'
'    If Cells(j, 10) >= H2_L Then
'      If Cells(j, 9) = 1 And Cells(j, 8) >= 7 Then
'
'        Range(Cells(j, 37), Cells(j, 41)).Select
'        Selection.Interior.color = IntColor
'        Selection.Value = 1
'        Exit For
'
'      Else
'
'        Range(Cells(j, 37), Cells(j, 41)).Select
'        Selection.Interior.color = IntColorN
'        Selection.Value = 0
'
'        For k = 1 To j + 10
'            If Cells(j + k, 9) = 1 And Cells(j + k, 8) >= 7 Then
'                Range(Cells(j + k, 37), Cells(j + k, 41)).Select
'                Selection.Interior.color = IntColor
'                Selection.Value = 1
'                Exit For
'            End If
'
'        Next k
'        Exit For
'      End If
'    End If
   
'Next i                                                                 '以上部分为增加的,意为当良否判定不良时,抽上下两盘光纤氢损。 以处结束。

Range("A1").Select


End Sub



Private Sub instruct_1(i1, a1, a2, a3, color, f)

Set R1 = Cells(i1, a1)
Set R2 = Cells(i1, a2)
Set R3 = Cells(i1, a3)
Union(R1, R2, R3).Select
Selection.Interior.color = color
Selection.Value = f

End Sub


Private Sub instruct_2(i, a1, a2, a3, a4, color, f)

Set R1 = Cells(i, a1)
Set R2 = Cells(i, a2)
Set R3 = Cells(i, a3)
Set r4 = Cells(i, a4)
Union(R1, R2, R3, r4).Select
Selection.Interior.color = color
Selection.Value = f

End Sub



Sub OTDR_instruct_again()

Dim f As Boolean
Dim SRN, ERN As Integer
Dim End_reel_N As Integer
Dim IntColor, IntColorN, IntColorNull As Double
Dim i, j, k, l, m, n, c1 As Integer
Dim total_L, accum_L, H2_L As Single
Dim R, RH As Single

Const max_reel_num As Integer = 80

Sheets("instruct").Select

SRN = 10
ERN = SRN + max_reel_num
total_L = Range("H4").Value
End_reel_N = Range("K4").Value
H2_L = Range("AN4")
IntColor = 65535
IntColorN = 12632256
IntColorNull = 13434879



For i = 2 To End_reel_N - 1
    j = SRN + i - 1
        
'敳偒庢傝5儕乕儖枅丂丂丟丂Dispersion
    If Cells(j, 13) = 9 And Cells(j, 19) = 1 Then
        Call instruct_1(j, 19, 21, 23, IntColorNull, 0)
        
        For k = 1 To j + 10
            If Cells(j - k, 13) = 1 Then
               
                Call instruct_1(j - k, 19, 21, 23, IntColor, 1)
               
                Exit For
            End If
        Next k
        
        For k = 1 To j + 10
            If Cells(j + k, 13) = 1 Then
               
                Call instruct_1(j + k, 19, 21, 23, IntColor, 1)
               
                Exit For
            End If
        Next k
   
    End If
   
'敳偒庢傝20儕乕儖枅丂丂丟丂僋儔僢僪宎丄僋儔僢僪旕墌棪丄曃怱検丄慺慄宎
'    If Cells(j, 13) = 9 And Cells(j, 26) = 1 Then
'        Call 巜帵棫偰_2(j, 26, 28, 30, 32, IntColorNull, 0)
'
'        For k = 1 To j + 10
'            If Cells(j - k, 13) = 1 Then
'
'                Call 巜帵棫偰_2(j - k, 26, 28, 30, 32, IntColor, 1)
'
'                Exit For
'            End If
'        Next k
'
'        For k = 1 To j + 10
'            If Cells(j + k, 13) = 1 Then
'
'                Call 巜帵棫偰_2(j + k, 26, 28, 30, 32, IntColor, 1)
'
'                Exit For
'            End If
'        Next k
'
'    End If


Next i

Range("A1").Select

End Sub

搜索更多相关主题的帖子: End Selection For If Then 
2019-04-23 11:19
厨师王德榜
Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18
等 级:贵宾
威 望:199
帖 子:987
专家分:4946
注 册:2013-2-16
收藏
得分:10 
最好结合数据来看,另外,子程序没有抓取完吧。
2019-04-23 14:22
xuminxz
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:41
帖 子:763
专家分:2503
注 册:2011-5-8
收藏
得分:10 
关键的地方有说明,用日文打开看看。

dBase有人接盘了。
2019-04-25 08:29
快速回复:求大神解释下什么意思
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022428 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved