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

[µo°Ý] Excel VBA ¦p¦ó¥Î inputbox ¨ú±oÀx¦s®æªº¦æ»P¦C

[µo°Ý] Excel VBA ¦p¦ó¥Î inputbox ¨ú±oÀx¦s®æªº¦æ»P¦C

§Ú·Q­n¨Ï¥Î inputbox ¨ú±o¬YÀx¦s®æªº¦æ»P¦C,

¼g¤F¤U¦Cªº VBA ªº¬O¤@ª½¥X²{¿ù»~, ½Ð±Ð¤j®a°ÝÃDÂI¦b¨º,

·PÁÂÀ°¦£.

    Dim code As Range
    Dim Code_Row As Integer
    Dim Code_Column As Integer
   
    code = Application.InputBox(prompt:="¿é¤J Code Äæ¦ì")  '¥X²{¨S¦³³]©wª«¥óÅܼƩΠwith °Ï¶ôÅܼÆ
    If code = "" Then Exit Sub
   
    Code_Row = code.Row
    Code_Column = code.Column

¦^´_ 5# c_c_lai
³o¼Ë¬O¤£·|¦³Error¡A¦ý¬O©Mµo°ÝªºÃD·N´N¤£¦X¤F
§Ú¶É¦V©ó
  1. set code = ActiveSheet.Range(Application.InputBox(Prompt:="¿é¤J Code Äæ¦ì"))
½Æ»s¥N½X
©Î
  1. set code = Application.InputBox(Prompt:="½ÐÂI¿ïÀx¦s®æ",Type:=8)
½Æ»s¥N½X
²Ä¤GºØ ¹ï¸Ü¤è¶ô ­n¥ÎÂI¿ïÀx¦s®æªº¤è¦¡¿é¤J

·íµM¡A¨âºØ¥i¯à³£ÁÙ­n¥t¥~¥[¤@¨Ç¨¾§b³B²zªºµ{¦¡½X

TOP

¦^´_ 1# seim
¦]¬°
  1.     Dim code As Range
½Æ»s¥N½X
«Å§i¬° Range ª«¥ó¡A¬G¤@¶}©l¥²¥ý¤©¥Hªì©l³]©w¹ïÀ³ª«¥ó¡G
  1.     Set code = [A1]    '  °²³]¨ä¬° A1 Äæ¦ì
  2.     code = Application.InputBox(Prompt:="¿é¤J Code Äæ¦ì")
½Æ»s¥N½X
¦p¦¹«K¤£·|¦³°ÝÃD¤F¡C

TOP

¦^´_ 1# seim
¥i¬d¬ÝExcel»¡©ú¤¤Application.InputBox
¨S«ü©w°Ñ¼ÆType®É¡A¹w³]¹ï¸Ü¤è¶ô·|¶Ç¦^¤å¦r
¦ý§A code = Application.InputBox(prompt:="¿é¤J Code Äæ¦ì")

µ¥¸¹¥ª¦¡¬°Rangeª«¥ó¡A¥k¦¡¬°¤å¦r¡A³o¼Ë·|§â¸Ó¤å¦rµ¹¨ìRangeªºvalueÄÝ©Ê(¹w³]ÄÝ©Ê)
¦ý§Aªºcode³o­ÓRange¤SÁÙ¨S³Qset(¥u¦³«Å§i¦Ó¤w)¡A©Ò¥H¤~·|¥X²{"¨S¦³³]©wª«¥óÅܼÆ"

TOP

½Ð°Ý¤@¤U, ¥H«á§Ú¦p¦óª¾¹D¨º¨Ç¬O¤º©w¨ç¼Æ, »Ý­nÁ׶}.

¦³ªí¥i¥H¬d¸ß¶Ü??

TOP

¦^´_ 1# seim


    code = Application.InputBox(prompt:="¿é¤J Code Äæ¦ì")  '¥X²{¨S¦³³]©wª«¥óÅܼƩΠwith °Ï¶ôÅܼÆ
    If code = "" Then Exit Sub

code ¬O¤º©w¨ç¼Æ¦WºÙ¡A½Ð¤Å¨Ï¥Î¡A§ï­Ó¦W¦r code1 ¤]¥i¥H
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

        ÀR«ä¦Û¦b : ¬O«D·í±Ð¨|¡AÆg¬ü§@ĵ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD