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

[µo°Ý] (ÁÂÁ¦h¦ìª©¥Dªº¤j¤OÀ°¦£¡A§¹¦¨)¦p¦ó±N©w¸q©µ¦ù¦¨¥i¥H¤â°Ê­×§ï?(¦Û­qªí³æ)

[µo°Ý] (ÁÂÁ¦h¦ìª©¥Dªº¤j¤OÀ°¦£¡A§¹¦¨)¦p¦ó±N©w¸q©µ¦ù¦¨¥i¥H¤â°Ê­×§ï?(¦Û­qªí³æ)

¥»©«³Ì«á¥Ñ av8d ©ó 2012-6-23 16:35 ½s¿è

Sub test()
    Dim rng As Range, cell As Range
    Application.ScreenUpdating = False
    w = "®a¥Î,¦­À\,¤ÈÀ\,±ßÀ\"
End Sub



§Ú°õ¦æ³£¬O¥ÎCall test

§Æ±æ¥i¥Hwªºªº­­¨î¥i¥H¤£­n¼g¦º~¥i¥H·s¼W§R°£­×§ï~

§Ú¸Ó«ç»ò°µ©O? §Ú¬O§_­n¦A»s§@¤@­ÓUserForm©O?

¦^´_ 7# av8d
³o­Ó°ÝÃD¤w¸g¦^µª¨ì³oµ{«×¡A§AÀ³¸Ó­n¥h¤F¸ÑÅܼƬO¦p¦ó¹B§@ªº
¬JµM¤w¸g¥Î¨ì©w¸q¦WºÙ¨ÓÀx¦s¦r¦ê
¨º»ò¡AwÅܼƴN¬O¸Ó©w¸q¦WºÙªº¤º®e
¤§«á¦b¾ã­Ó¬¡­¶Ã¯¤º­n½Õ¥Î³o­Ó¦r¦ê
¥u­n©I¥s¸Ó¦WºÙ§Y¥i
  1. Sub auto_open() '¶}±ÒÀÉ®×®ÉIJµo¦¹µ{§Ç
  2. Dim n As Name
  3. For Each n In ThisWorkbook.Names 'Àˬd¬¡­¶Ã¯¤ºªº¦WºÙ
  4.    If n.Name = "³rÂI¤À¹j¦r¦ê" Then Exit Sub '¦pªG¦¹¦WºÙ¦s¦b´NÂ÷¶}µ{§Ç
  5. Next
  6. ThisWorkbook.Names.Add "³rÂI¤À¹j¦r¦ê", "®a¥Î,¦­À\,¤ÈÀ\,±ßÀ\", 0 '¥[¤JÁôÂ꺦WºÙ
  7. End Sub

  8. Sub ¥Dµ{§Ç()
  9. w = [³rÂI¤À¹j¦r¦ê] '¨ú¥X¦WºÙ¤º®e½áµ¹ÅܼÆ
  10. MsgBox w
  11. End Sub
  12. Sub ­×§ï()
  13. Dim mystr$
  14. mystr = InputBox("¿é¤J³rÂI¤À¹j¦r¦ê", , [³rÂI¤À¹j¦r¦ê]) '¿é¤J·s¦r¦ê
  15. If mystr = "" Then MsgBox "¦r¦ê¤£±o¬°ªÅ¥Õ": Exit Sub 'Á׶}ªÅ¦r¦ê¨ú¥N­ì©w¸q¤º®e
  16. Names("³rÂI¤À¹j¦r¦ê").Value = mystr '±N·s¦r¦ê¼g¤J¦WºÙ
  17. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 7# av8d
  1. Option Explicit
  2. 'Public xlTheW  As String   'Public ©Ò¦³¼Ò²Õ¬Ò¥i¥ÎªºÅܼÆ
  3. Private xlTheW As String    'Private ©Î Dim    ¥u¦³³o¼Ò²Õ¥i¥H¥ÎªºÅܼÆ
  4. Sub Auto_Open()   '¦¹µ{§Ç¥Î·N¦b¦p¨S¦³©w¸q¦WºÙ ·s¼W©w¸q¦WºÙ
  5.     Dim Msg As Boolean, n As Name
  6.     'Boolean ¸ê®Æ«¬ºA   ¹w³]¬° False
  7.     'Boolean ÅܼƫY¥H 16 ¦ì¤¸( 2 ­Ó¦ì¤¸²Õ)¼Æ¦rªº§Î¦¡Àx¦s¡A¦ý¥u¯à¬O True ©Î¬O False¡CBoolean Åܼƪº­È¤£¬O True ´N¬O False ( ¦b¨Ï¥Î Print ªº®É­Ô )¡A©Î¬O #TRUE# ©M #FALSE# ( ¦b¨Ï¥Î Write # ªº®É­Ô )¡C¨Ï¥ÎÃöÁä¦r True »P False ¥i±N Boolean Åܼƫü©w¬°³o¨â­Óª¬ºA¤¤ªº¤@­Ó¡C
  8.     '·íÂà´«¨ä¥Lªº¼Æ­È«¬ºA¬° Boolean ®É¡A0 ·|Âন False¡A¦Ó©Ò¦³¨ä¥Lªº­È«hÅܦ¨ True¡C·íÂà´« Boolean ­È¬°¨ä¥Lªº¸ê®Æ«¬ºA,®É¡AFalse ¦¨¬° 0 ¡A¦Ó True ¦¨¬° -1¡C
  9.     With ThisWorkbook                                   ' With  ³o¬¡­¶Ã¯
  10.         For Each n In .Names                            '.Names : ³o¬¡­¶Ã¯ªº©w¸q¦WºÙ¶°¦X
  11.             If n.Name = "w" Then Msg = True: Exit For    '§ä¨ìw : Msg = True
  12.         Next
  13.         If Msg = False Then .Names.Add "w", "®a¥Î,¦­À\,¤ÈÀ\,±ßÀ\"
  14.         '¨S§ä¨ìw : Msg = False   ;'.Names.Add : ¬¡­¶Ã¯¤¤·s¼W©w¸q¦WºÙ
  15.     End With
  16. End Sub
  17. Sub ­×§ï()   '³oµ{§Ç ¥Î©ó§Aªº­×§ï
  18.     Dim A As String
  19.     A = InputBox("¿é¤J³rÂI¤À¹j¦r¦ê", , [W])
  20.     If A <> "" Then ThisWorkbook.Names("w").Value = A   '¥i¹w¨¾   ¨ú®øInputBox ©Î¬O  = ""
  21. End Sub
  22. Sub test()    '§A­n©óµ{¦¡¤¤¨ú±o¦WºÙªº­È
  23.     Dim A
  24.     xlTheW = [W]                                        '±N¦WºÙªº­È¶Çµ¹ xlTheW
  25.    ' xlTheW = Evaluate(ThisWorkbook.Names("W").Value)    '±N¦WºÙªº­È¶Çµ¹ xlTheW
  26.     MsgBox xlTheW
  27. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ av8d ©ó 2012-6-25 08:43 ½s¿è

¦^´_ 6# GBKEE


    ¤j¤jÁÂÁ¡A½Ð°Ý§Ú¸Ó¦p¦ó©M§Úªºµ{¦¡½X°µµ²¦X©O
Sub test()
    Dim rng As Range, cell As Range
    Application.ScreenUpdating = False
    w = "®a¥Î,¦­À\,¤ÈÀ\,±ßÀ\"
End Sub

¥Ñ©ó   w = "®a¥Î,¦­À\,¤ÈÀ\,±ßÀ\"  ¤U¤èÁÙ¦³«Ü¦hµ{¦¡½X

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-6-23 08:47 ½s¿è

¦^´_ 5# av8d
Ãö³¬Excel ÅܼƴNÂk0¤F,¥i¥Î©w¸q¦WºÙ«O¯d¦í
  1. Option Explicit
  2. Sub Auto_Open()
  3. Dim Msg As Boolean, n As Name
  4. With ThisWorkbook
  5.     For Each n In .Names
  6.         If n.Name = "w" Then Msg = True: Exit For
  7.     Next
  8.     If Msg = False Then .Names.Add "w", "®a¥Î,¦­À\,¤ÈÀ\,±ßÀ\"
  9. End With
  10. End Sub
  11. Sub ­×§ï()
  12.     Dim A As String
  13.     A = InputBox("¿é¤J³rÂI¤À¹j¦r¦ê", , [w])   
  14.     If A <> "" Then ThisWorkbook.Names("w").Value = A   '¥i¹w¨¾   ¨ú®øInputBox ©Î¬O  = ""  
  15.     MsgBox [w]   '©w¸q¦WºÙ¤º®e
  16. End Sub
½Æ»s¥N½X
1

µû¤À¤H¼Æ

TOP

¥»©«³Ì«á¥Ñ av8d ©ó 2012-6-23 00:25 ½s¿è

¦^´_ 4# Hsieh


    ÁÂÁ¤j¤j~³o¤èªk«Ü¦n¥Î~¥i¬O

°_©l¸ê®Æ-->®a¥Î,¦­À\,¤ÈÀ\,±ßÀ\
­×§ï«á-->®a¥Î,¦­À\,¤ÈÀ\,±ßÀ\,¯S§O¶O
Ãö³¬Excel
¶}±ÒExcel
¸ê®ÆÅܦ¨°_©l¸ê®Æ-->®a¥Î,¦­À\,¤ÈÀ\,±ßÀ\
¦Ó¤£¬O­×§ï«áªº¸ê®Æ-->®a¥Î,¦­À\,¤ÈÀ\,±ßÀ\,¯S§O¶O

¤£ª¾¹D³o¬O¤°»ò­ì¦]?
¬O¤£¬O¦]¬°¥u­n¬O°O¾Ðªº³¡¤À³£¥²¶·¦bÀx¦s®æ¤W¤~¯àÀx¦s?¦p A1  B1  C1 µ¥µ¥

TOP

¦^´_ 3# av8d


    ³oÀ³¸Ó¬O¤½¥ÎÅܼƳ]¸mªº§Þ¥©´N¯à¸Ñ¨M
§A¬O¦b¦¹¥Dµ{¦¡¤¤­n¤Þ¥ÎwÅܼÆ
¦b¤@¯ë¼Ò²Õ«Å§i¤½¦@ÅܼÆw
  1. Public w$
½Æ»s¥N½X
¶}±ÒÀɮ׮ɥý±Nwµ¹­È
  1. Sub auto_open()
  2. w = "®a¥Î,¦­À\,¤ÈÀ\,±ßÀ\"
  3. End Sub
½Æ»s¥N½X
°õ¦æ­×§ïµ{§Ç
  1. Sub ­×§ï()
  2. w = InputBox("¿é¤J³rÂI¤À¹j¦r¦ê", , w)
  3. End Sub
½Æ»s¥N½X
¥Dµ{¦¡
  1. Sub test()
  2. MsgBox w
  3. End Sub
½Æ»s¥N½X
¤½¥ÎÅܼÆ.rar (7.78 KB)
1

µû¤À¤H¼Æ

¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ av8d ©ó 2012-6-22 23:50 ½s¿è
w = InputBox("¿é¤J¦r¦ê¡A¥Î¨§¸¹¤À¶}¡G")
    If w = "" Then End
oobird µoªí©ó 2012-6-22 12:57



  w¬O§_ªº­È¬O§_¯à©T©w?
¨C·í»Ý­n·s¼W§R°£­×§ïªº®É­Ô¦bŪ¨ú¥\¯àÁä

TOP

w = InputBox("¿é¤J¦r¦ê¡A¥Î¨§¸¹¤À¶}¡G")
    If w = "" Then End
1

µû¤À¤H¼Æ

TOP

        ÀR«ä¦Û¦b : µÊ®ð¼L¤Ú¤£¦n¡A¤ß¦a¦A¦n¤]¤£¯àºâ¬O¦n¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD