返回列表 上一主題 發帖

請教MultiPage用法

請教MultiPage用法

本帖最後由 fei6999 於 2011-3-11 16:02 編輯

MultiPage.rar (10.9 KB) 請教高手
程式如下因MultiPage語法不懂
如何使Page1,2,3執行時不互相干擾有錯請指正
執行到If MultiPage2.Value = True Then時會中斷出現錯誤訊息!

Private Sub CommandButton1_Click()
Dim gj As Variant
Dim kj As Long
ActiveSheet.Unprotect


If MultiPage1.Value = True Then
      MsgBox 1
        gj = TextBox1
        If gj > 35 Or gj < 1 Then Unload Me: MsgBox "欄位超出範圍": Exit Sub
          If TextBox3 > 0 Then
          '未完成
         ' Cells(gj + 7, 2) = Range("d3")
         ' Cells(gj + 7, 4) = "=$d$3"
          End If

  End If

'*********減資*******************



If MultiPage2.Value = True Then
      MsgBox 2
      '未完成
            If TextBox2 >= 100 Then Unload Me: MsgBox "比例大於100": Exit Sub
            kj = Cells(gj + 7, 8)
            If kj = 0 Then Unload Me: MsgBox "第" & gj & "筆無資料": Exit Sub
            If TextBox2 > 0 Then
              Cells(gj + 7, 8) = Int(kj * (1 - (TextBox2 / 100)))
              Cells(gj + 7, 10) = Round((Cells(gj + 7, 15) - Cells(gj + 7, 22)) / Cells(gj + 7, 8), 2)
            End If
End If

'**PAEG3***********
If MultiPage3.Value = True Then
     MsgBox 3
   If CheckBox1 = True Then
       For gj = 1 To 35
         If Cells(gj + 7, 15) = "" Then
   
               MsgBox gj
               If gi > 35 Then Exit Sub
         Else
           If OptionButton1 = True Then

               Cells(gj + 7, 15) = Cells(gj + 7, 15) + Cells(gj + 7, 11) + Cells(gj + 7, 21)
               Cells(gj + 7, 11) = ""
               Cells(gj + 7, 9) = "現"
           End If
        
           If OptionButton2 = True Then
              h = Cells(gj + 7, 21)
              Cells(gj + 7, 11) = Cells(gj + 7, 11) - TextBox5
              c = Cells(gj + 7, 21)
              Cells(gj + 7, 15) = Cells(gj + 7, 15) + TextBox5 + h - c
           End If
         End If
       Next
         If gi > 35 Then Exit Sub
   End If 'CheckBox1
End If

'**********************************************


   Unload Me
   ActiveSheet.Protect

End Sub

感謝!問題解決了
小弟新手一個希望有機會多多學習

TOP

        靜思自在 : 【行善要及時】行善要及時,功德要持續。如燒開水一般,未燒開之前千萬不要停熄火候,否則重來就太費事了。
返回列表 上一主題