ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦p¦ó§Ö³tÅÜ´«Workbook_Openªº¨âºØ¥\¯à»Ý¨D?

[µo°Ý] ¦p¦ó§Ö³tÅÜ´«Workbook_Openªº¨âºØ¥\¯à»Ý¨D?

¥»©«³Ì«á¥Ñ av8d ©ó 2012-7-3 09:11 ½s¿è

Private Sub Workbook_Open()
    Range ("A1")
End Sub

Private Sub Workbook_Open()
    Range ("Z1")
End Sub

¥H¤W¬°½d¨Ò~¬O§_¦³¤°»ò¤èªk¥i¥H§Ö³tÅÜ´«Workbook_Open¤ºµ{¦¡½Xªº¤º®e?
¨Ò¦p§Ú»s§@¨â­ÓOptionButton¡A¤À§O©R¦W¬°A1©MZ1
·íÂI¨ìA1ªº®É­ÔWorkbook_Open´NÂà´«¦¨A1
·íÂI¨ìZ1ªº®É­ÔWorkbook_Open´NÂà´«¦¨Z1

°ÝÃDµy©ú®Ô¨Ç¤F¡I
Book1.rar (10.87 KB)

TOP

¥»©«³Ì«á¥Ñ av8d ©ó 2012-7-3 22:09 ½s¿è

¦^´_ 2# GBKEE

¥H¤U³£¬OActiveX±±¨î¶µ:

¦pªG§ï¦¨
·í¿ï¨úOptionButton1°µ
Private Sub CommandButton10_Click()
Range("A1")
End Sub
·í¿ï¨úOptionButton2°µ
Private Sub CommandButton10_Click()
Range("Z1")
End Sub

¤]¾A¥Î¤j¤j´£¨Ñªº¤èªk®M¥Î¶Ü?
·í¿ï¨úOptionButton1Ãö³¬ÀɮצA¶}±Ò
¥L·|²¾°Ê¨ìA1
·í¿ï¨úOptionButton2Ãö³¬ÀɮצA¶}±Ò
¥L·|²¾°Ê¨ìZ1

¨¯­W¤j¤j¤F~ÁÂÁÂ!

TOP

¦^´_ 1# av8d
  1. Option Explicit
  2. Private Sub Workbook_Open()
  3.     '¨Ò¦p§Ú»s§@¨â­ÓOptionButton¡A¤À§O©R¦W¬°A1©MZ1
  4.     '**--- ¨â­ÓOptionButton  ¬O¦P¤@¸s²Õ
  5.     Dim e As Shape, Rng As Range
  6.     With Sheets("Sheet1")
  7.         For Each e In .Shapes
  8.             If e.Name = "A1" Or e.Name = "Z1" Then
  9.                 If e.Type = 12 Then                     '±±¨î¤u¨ã½c¤u¨ã¦Cªº OptionButton
  10.                     If .OLEObjects(1).Object.Value Then Set Rng = .Range(e.Name)
  11.                 ElseIf .Shapes(1).Type = 8 Then         'ªí³æ¤u¨ã¦Cªº Option Button
  12.                     If e.OLEFormat.Object.Value Then Set Rng = .Range(e.Name)
  13.                 End If
  14.             End If
  15.           Next
  16.     End With
  17. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¦³®É·í«äµL®É­W¡A¦n¤Ñ­n¿n«B¨Ó³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD