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

[µo°Ý] ¤£¶}±Òexcel¤å¥ó¯àª¾¹D³o¤å¥ó¨½¦³¨S¦³¦W¬°"ABC"ªºsheet?

[µo°Ý] ¤£¶}±Òexcel¤å¥ó¯àª¾¹D³o¤å¥ó¨½¦³¨S¦³¦W¬°"ABC"ªºsheet?

¥»©«³Ì«á¥Ñ mhl9mhl9 ©ó 2015-8-10 23:01 ½s¿è

¤½¥q¸ê®Æ®w§ï¤F¤å¥ó®æ¦¡(¤À¦U¤½¥q§ïªº¤é´Á¤£²Î¤@),§Ú­n±q¤£¦P®æ¦¡ªº¤å¥ó¨½¨ú¼Æ¾Ú,¥²¶·¥ýª¾¹D¤å¥ó¬O·s®æ¦¡ÁÙ¬O®榡,²{¦b·Q¦b¨ú¸ê®Æ«e¥ýª¾¹D¤å¥ó¨½¦³¨S¦³¤@­Ó¦W¬°"ABC"ªºsheet,¦]¬°Â¤å¥ó¨S¦³"ABC"sheet,¦³"ABC"sheetªº´N¤@©w¬O·s®æ¦¡,¯à¦³¤èªkª¾¹D¶Ü?
±q¤å¥ó¦WµLªk°Ï§O,¦]¬°©Ò¦³¤å¥ó³£¬O01,02,03,04.....
±q¤é´Á¤]µLªk°Ï§O,¦]¬°¦U¤À¤½¥q¨S¦³²Î¤@ªº¤é´Á§ïª©....
²{¦b·Q¨ì¯à°Ï§O·sª©Âª©ªº¤èªk´N¬O¤å¥ó¨½¦³¨S¦³sheets("ABC").....
½Ð¦U¦ì°ª¤âÀ°À°§Ú,¦hÁ¤F!

ª¾¹D¤å¥ó¸ô®|,¤å¥ó¦W,sheet¦W©MÀx¦s®æ°Ñ¼Æ,¦³¤½¦¡¥i¥H¤£¶}±Ò¸Ó¤å¥ó¦Ó¨ú±o¸Ó«ü©wªºÀx¦s®æªº­È,¤½¦¡¥X¿ù´N¬O®榡¤å¥ó(¦]¬°Â®榡¤å¥ó¨½¨S¦³sheet("Abc"),¤£¥X¿ù´N¬O·s®æ¦¡¤å¥ó,§Ú¬Ý¦¹¤èªk¥i¯à¦æ±o³q,¦ý¥i¯à·|©ìºCµ{§Ç,¬O¤£¬O¦³§ó²³æ¦³®Äªº¤èªk°Ï§O·s®榡ªº¤å¥ó,¨D°ª¤âÅãÆF¬Û§U.
lmh

¦^´_ 1# mhl9mhl9

°ò¥»¬[ºc¨Ñ±z°Ñ¦Ò
  1.     Sub IsSheetExist()
  2.     Dim ws As Worksheet
  3.     Dim sName As String
  4.     sName = "¤@¤ë"  '«ü©w¤u§@ªí
  5.     On Error Resume Next
  6.     Set ws = Sheets(sName)
  7.     If ws Is Nothing Then '«ü©wªº¤u§@ªí¤£¦s¦b
  8.       Sheets.Add.Name = sName
  9.     Else '«ü©wªº¤u§@ªí¤w¦s¦b
  10.       MsgBox "¡§" & sName & "¡¨¤u§@ªí¤w¦s¦b¡C"
  11.       ws.Activate
  12.     End If
  13.     End Sub
½Æ»s¥N½X

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

¦^´_ 2# mark15jill
¥i¯à§Ú³¯­z¤£²M·¡,§Úªº­n¨D¬O"¤£¶}±Òexcel¤å¥ó,¦p¦óª¾¹D¬Y¤å¥ó¨½¦³¬Ysheet¦s¦b",©Ò¥H§Aªº°µªk¤£¯à¥Î,§Ú¦Û¤v¼g¤F­Ófunction,¤w¸g¥Î¤W,¤£¤Ó¼vÅTµ{§Ç°õ¦æ³t«×.

''''´ú¸Õ¤å¥ófl(fl¬O¤å¥óªº¸ô®|)¨½¦³¨S¦³sheets("Test A"),¦Ó¸Ósheetªº[A1]="ABC"

Function Benew(fl$) As Boolean
    Dim Fname$, Fpath$, temp$, temp2
    Fname = Right(fl, Len(fl) - InStrRev(fl, "\"))
    Fpath = Replace(fl, Fname, "")
    On Error Resume Next
    temp = "'" & Fpath & "[" & Fname & "]Test A'!R1C1"
    temp2 = Application.ExecuteExcel4Macro(temp)
    Benew = IIf(temp2 = "ABC", True, False)
End Function

§Ú­n±q55000­Ó¤å¥ó´£¨ú¸ê®Æ.¦]¬°³o¨Ç¤å¥ó¦³2ºØ¤£¦P®æ¦¡,¨ä¤¤1ºØ®æ¦¡¬O¤å¥ó¨½¦³±isheet,¦W¬°"Test A",¦Ó¥BTest A­¶ªº[a1]="ABC"
§Ú²{¦b§Q¥Î¤W­±function,§Y®É¥i¥H°Ï¤À³o55000¤å¥ó,­þ¨Ç¬O²Ä¤@ºØ®æ¦¡,­þ¨Ç¬O²Ä¤GºØ®æ¦¡,µM«á¥Î¤£¦Pªº¤èªk¨ú¸ê®Æ.¨Ã¤£¤Q¤À¼vÅT³t«×.
¦]¬°©T©w®æ¦¡ªº¸ê®Æ¨½¥²©w¦³¬Y©T©w¦ì¸mªº­È¬O©T©wªº,¤W­±¨úªº[a1]="ABC"´N¬O©T©w¦ìªº·N«ä¥Ü·N.
lmh

TOP

        ÀR«ä¦Û¦b : ¦³¦h¤Ö¤O¶q´N°µ¦h¤Ö¨Æ¡A¤£­n¤ß¦sµ¥«Ý¡Aµ¥«Ý¤~·|¸¨ªÅ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD