- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-9-25 10:53 ½s¿è
¦^´_ 5# 317
½Ð±Nµ{¦¡½X½Æ»s¨ì :VBAµøµ¡ªºThisWorkbook¤¤,¦sÀÉ«á«·s¶}ÀÉ«K¥i- Private Sub Workbook_Open()
- Dim ±K½X As String, Sh As Worksheet
- ±K½X = "1234"
- Set Sh = ActiveSheet '§@¥Î¤¤ªº¤u§@ªí
- 'Set Sh = Sheet1 'VBA ª«¥ó¦WºÙ
- 'Set Sh = Sheets("³Â»¶®a±Ú°Q½×") '¬¡¶Ã¯¤u§@ªí¦WºÙ
- 'Set Sh = Sheets(2) '¬¡¶Ã¯¤u§@ªíªº±Æ§Ç
- With ThisWorkbook 'ThisWorkbook -> VBA ªº¬¡¶Ã¯ª«¥ó
- .Names.Add "¤é´Á", Date - 1, False '¬¡¶Ã¯©w¸q¦WºÙ, False->ÁôÂÃ
- '°õ¦æ¤@¦¸«á½Ð¦b«e±¥[¤Wµù¸Ñ " ' " ©Î §R°£ °±¤î¦¹µ{¦¡½X°õ¦æ
-
- If Val(Replace(.Names("¤é´Á"), "=", "")) <> Date Then '¤£¬O¤µ¤é
- .Names("¤é´Á").Value = Date 'קïValue¬°¤µ¤é
- .Names.Add "MyRange", Sh.UsedRange ', False '©w¸q¦WºÙ"MyRange" ½d³ò«ü©w¬° ActiveSheet.UsedRange
- '.Names.Add "MyRange", Sh.UsedRange , False 'False->©w¸q¦WºÙÁôÂÃ
- With Sh '«ü©wªº¤u§@ªí
- .Unprotect ±K½X '¨ú®ø¤u§@ªí«OÅ@
- .Cells.Locked = False '¨ú®øÀx¦s®æÂê©w->¤u§@ªíªºCells
- .Cells.FormulaHidden = False '¨ú®øÀx¦s®æÁôÂÃ->¤u§@ªíªºCells
- Range("MyRange").Locked = True 'Àx¦s®æÂê©w-> "MyRange"ªº½d³ò
- Range("MyRange").FormulaHidden = True 'Àx¦s®æÁôÂÃ-> "MyRange"ªº½d³ò
- .Protect ±K½X '¤u§@ªí³]©w«OÅ@
- End With
- End If
- End With
- End Sub
½Æ»s¥N½X |
|