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

[µo°Ý] ¤u§@ªíÅã¥Ü»PÁôÂÃ

[µo°Ý] ¤u§@ªíÅã¥Ü»PÁôÂÃ

¥H¼¶¼gµ{¦¡½X¦p¤U¡A²Ä¤@¦¸ÂI¿ï¥kÁä¥i¥HÁôÂóæ¤@¤u§@ªí¡A²Ä¤G¦¸ÂI¿ï¥kÁä«oÁôÂéҦ³¤u§@ªí¡A½Ð°Ý°ÝÃD¦b­þ¸Ì?
µ{¦¡½X»Pªþ¥ó¦p¤U
  1. Private Sub Worksheet_Activate()
  2. Dim i, n As Integer
  3. Dim a As String
  4.     n = Sheets.Count
  5. For i = 1 To n
  6.     If Sheets(i).Name <> Cells(i + 1, 2) Then
  7.         a = Cells(i + 1, 2)
  8.         If a = "" Then Exit Sub
  9.         Sheets(i).Name = a
  10.     End If
  11. Next
  12. End Sub

  13. Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

  14. End Sub


  15. Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
  16. Dim i, n As Integer
  17.     n = Sheets.Count
  18. For i = 2 To n
  19. If Target = Cells(i + 1, 4) Then
  20.     If Cells(i + 1, 4).Interior.Color = vbBlue Then
  21.         Cells(i + 1, 4) = "Åã¥Ü¤u§@ªí"
  22.         Cells(i + 1, 4).Interior.Color = vbRed
  23.         Worksheets(i).Visible = False
  24.     Else
  25.         Cells(i + 1, 4) = "ÁôÂäu§@ªí"
  26.         Cells(i + 1, 4).Interior.Color = vbBlue
  27.         Worksheets(i).Visible = True
  28.     End If
  29. Else

  30. End If
  31. Next
  32. End Sub
½Æ»s¥N½X
1563740111775.zip (16.43 KB)

NEW: ¤u§@ªíÅã¥Ü»PÁôÂÃ

¥N½X¤w¸g§ó·s¤F¡A¦ý¬OÁÙ¬Oµo¥ÍÂI¿ï¤@­Ó¤u§@ªí¡A«oÁôÂèâ­Ó¤u§@ªí¡C
  1. Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
  2. Dim i, n As Integer
  3.     n = Sheets.Count
  4. For i = 2 To n
  5. If Target = Cells(i, 4) Then

  6.     If Cells(i, 4).Interior.Color = vbBlue Then
  7.         Cells(i, 4) = "Åã¥Ü¤u§@ªí"
  8.         Cells(i, 4).Interior.Color = vbRed
  9.         Worksheets(i - 1).Visible = xlSheetVisible
  10.     Else
  11.         Cells(i, 4) = "ÁôÂäu§@ªí"
  12.         Cells(i, 4).Interior.Color = vbBlue
  13.         Worksheets(i - 1).Visible = xlSheetVeryHidden
  14.     End If
  15. Else
  16.    
  17. End If
  18. Next
  19. End Sub
½Æ»s¥N½X

TOP

1563809548299.gif

TOP

¬Ý¤£À´­n°µ¤°»ò???
¶]°j°é, ·íµM·|¦h±i¤u§@ªíÅã¥Ü©ÎÁôÂÃ~~

TOP

·Qªk:¥i³z¹LÂI¿ï¨Ó§ïÅܤu§@ªíªºÅã¥Ü»PÁôÂïS©Ê

TOP

Sol: ¤u§@ªíÅã¥Ü»PÁôÂÃ

¤w¸g§ä¨ì°ÝÃD¤F¡A§Q¥Îwith selection §Y¥i¡A¤£»Ý­n°j°é¨ç¼Æ
  1. Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
  2. On Error Resume Next
  3.     With Selection(1)
  4.       If Target = Cells(.Row, 4) Then
  5.         If Cells(.Row, 4).Interior.Color = vbBlue Then
  6.             Cells(.Row, 4) = "Åã¥Ü¤u§@ªí"
  7.             Cells(.Row, 4).Interior.Color = vbRed
  8.             Worksheets(.Row - 1).Visible = xlSheetVisible
  9.         ElseIf Cells(.Row, 4).Interior.Color = vbRed Then
  10.             Cells(.Row, 4) = "ÁôÂäu§@ªí"
  11.             Cells(.Row, 4).Interior.Color = vbBlue
  12.             Worksheets(.Row - 1).Visible = xlSheetVeryHidden
  13.         Else
  14.         End If
  15.     End If
  16.     End With
  17.    
  18. End Sub
½Æ»s¥N½X

TOP

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
With Cells(Target(1).Row, 2)
     On Error GoTo 999
     CK% = Sheets(.Value).Visible + 1
     Sheets(.Value).Visible = CK
     .Cells(1, 3) = Array("Åã¥Ü¤u§@ªí", "ÁôÂäu§@ªí")(CK)
     .Cells(1, 3).Interior.Color = Array(vbRed, vbBlue)(CK)
End With
999: End Sub


=============================

TOP

¦^´_ 7# ­ã´£³¡ªL
ÁÂÁ¤j¤j¡A¦pªG­n§ï¦¨ xlSheetVeryHidden ­n«ç»ò°µ

TOP

¦^´_ 8# henry860608

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
With Cells(Target(1).Row, 2)
     On Error GoTo 999
     ck% = Abs(1 - Sheets(.Value).Visible)
     Sheets(.Value).Visible = ck
     .Cells(1, 3) = Array("ÁôÂäu§@ªí", "Åã¥Ü¤u§@ªí")(ck - 1)
     .Cells(1, 3).Interior.Color = Array(vbBlue, vbRed)(ck - 1)
End With
999: End Sub

¦Û¦æ¬ã¨s¤U:
xlSheetVisible = -1
xlSheetHidden = 0
xlSheetVeryHidden = 2

========================

TOP

¦^´_ 9# ­ã´£³¡ªL
ÁÂÁ­㴣³¡ªL¡A¨C¦¸¬Ý¨ì§Aªºµ{¦¡³£Åý§Ú«ÜÅå³Y
ºë²¦Ó¥B®e©ö¤F¸Ñ¡A·P®¦

TOP

        ÀR«ä¦Û¦b : ¦Y­W¤F­W¡B­WºÉ¤Ü¨Ó¡A¨ÉºÖ¤FºÖ¡BºÖºÉ´d¨Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD