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

4­ÓVBA°ÝÃD

4­ÓVBA°ÝÃD

²Ä1  sheet1    B1=2  C1=M   
dim n ,i
[D1]="Range("B"& n)   Range("C"& i)"  (¦]¬° Range·|ÅÜ­n³o¼Ë¼g)

²Ä2  ¦n¦h®É§Ú³£¦bsheet1 ¥Î«ö¶srun vba   1¶}©l­n¦bsheet2  §Ú·|¥ý¼g
sheets("sheet2").Select
¦ýsheet2ªº¦W§ï¤F "abc"  ¦bvba¤S­n§ïsheets("abc").Select
¦³¤°»ò¼g §ï¤Fsheet¦W³£¥i¥H¥¿±`run vba.

²Ä3
³o¼Ë¼g¹ï¶Ü?
sheets("sheet2").Range("A1").Value=sheets("sheet1").Range("A1").Value
¦pªG§ï¤Fsheet¦W³£¥i¥Hrun­n¦p¦ó¼g?

²Ä4
³o­Ó«ÜÃø><
sheet2

a1= 10 / ©ú/abc

·ía1¿é¤J1­Ó¼Æor¤å¦r   «örun    if  a1ªº¼Æor¤å¦r¬O²Ä1¦¸¤Jªº®É­Ô  c1·|¥X1   vba·|°O¸ü³o­Ó¼Æor¤å¦r
                                             if  ²Ä2¤J´N c1¥X2 .....................

eg.   
a1=10 > run>c1=1   >   a1=momo>run>c1=1  >    save  execl off execl  >open excel >    a1=momo>run>c1=2  >a1=haha>run>c1=1

¦pªGa1ªº¼Æor¤å¦r¦³ 300¦h­Ó vba¥i¥Hsave¶Ü?

VBA.rar (7.74 KB)

50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

¦^´_ 15# kimbal


    ÁÂÁ¤j¤j^^
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¦^´_ 13# basarasy


¦³Ãö "e1  and  f1  ¦³°ÝÃD"
¥i¥H§â
    Dim es As String
ªº as string ®³¨«´N¥i¥H¤F

"¦pªG§Ú­n§âentriesªºªF¦èsave¦b ¨ä¥Lexcel­n¦pªG¼g?"
¾Ç²ß¥¨¶°°ò¥»ªk: ¿ý»s¥¨¶°

¦bexcel¤W
1. ¶}µo¤H­û->¿ý»s¥¨¶°, «ö½T©w
2. ±`¥Î->Àx¦s®æ->®æ¦¡->²¾°Ê©Î½Æ»s¤u§@ªí, ¿ï¦ì¸m
3. ¶}µo¤H­û->°±¤î¿ý»s
¨ìvbe¬d¬Ý¥¨¶°
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

¦pªG§Ú­n§âentriesªºªF¦èsave¦b ¨ä¥Lexcel­n¦pªG¼g?
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¥»©«³Ì«á¥Ñ basarasy ©ó 2010-7-25 17:05 ½s¿è

¦^´_ 12# kimbal

¤j¦h³£©ú¥Õ¤F.ÁÂÁ¤j¤j
¥u­n§âentries   del´N¥i¥H ªì´Á¤Æ¤F.

e1  and  f1  ¦³°ÝÃD
§Ú¤Je1¦Pf1 ¨ä¹ê¬O  ·í§Úa1=10®É ¤£¤p¤ß«ö¤F2¤Urun  c1¥X¤F2  ¤§«á¤Je1=10 f1=1 >run  c1´N·|
Åܦ^1.  ¤£¥Î§âe1¦Pf1 save¦bentries,¥u­n§ïentries¤º ¹ï·Óªºb:b ´Nok¤F.

¤£save¬O§_§ï
If es = "" Then
            .Range("A1").Offset(currRow - 1) = v
            End If

If es = "" Then        
        .Range("A1").Offset(currRow - 1, 1) = nextvalue
        End If  ³o­Ó?

¦ý§ïentries¤º ¹ï·Óªºb:b¤£ª¾§ï¨º¸Ì.
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¦^´_ 11# basarasy
¦³Ãöc1°ÝÃD, ¤§¦¸¿ù§R¤F¤@¤U,¥i¥H¦A¸Õ¸Õ³o­Ó
  1.     On Error Resume Next
  2.     Dim currRow As Long
  3.     Dim es As String
  4.     Dim e As Integer
  5.     Dim nextvalue As Integer
  6.     Dim sheetname As String
  7.    
  8.     sheetname = Worksheets("entries").Name
  9.    
  10.     If sheetname = "" Then
  11.         MsgBox ("Sheet ""entries"" not found!")
  12.         Exit Sub
  13.     End If
  14.     currRow = 0
  15.    
  16.     v = Range("A1")
  17.    
  18.     es = Range("E1").Value
  19.     e = Range("F1").Value
  20.     If es <> "" Then
  21.         v = es
  22.     Else
  23.         e = 0
  24.     End If
  25.    
  26.     currRow = WorksheetFunction.Match(v, Worksheets(sheetname).Range("A:A"), False)
  27.     With Worksheets(sheetname)
  28.         If currRow = 0 Then
  29.             currRow = .Range("A65536").End(xlUp).Row + 1
  30.             .Range("A1").Offset(currRow - 1) = v
  31.             nextvalue = 1
  32.         Else
  33.             nextvalue = .Range("A1").Offset(currRow - 1, 1) + 1
  34.         End If
  35.         If e > 0 Then
  36.             nextvalue = e
  37.         End If
  38.         .Range("A1").Offset(currRow - 1, 1) = nextvalue
  39.     End With
  40.    
  41.     If currRow > 0 Then
  42.         Range("C1").Value = nextvalue
  43.     End If
½Æ»s¥N½X
³o­Ó©ÎªÌ§A¸Õ¸Õ¦Û¤v°Ê¤â§a,
"¥i¥H¥[¦h­Óg1   if  g1=1 ´N§â ©Ò¦³saveªºªF¦èdel"
saveªº¥N½X¬O
thisworkbook.save

"ÁÙ¦³,¦pªG§Ú³o­Óexcel¦³°ÝÃD,"
¥i¥H,vba¤º®e¸ò¨S¦³¸òworkbook©w¦ì.... §A¤]¸Õ¸Õ¤F¸Ñ¤@¤U¤¤Ãö¹B§@§a~¦³¦æ¼Æ¤£©ú¥Õ¥i¥H°Ý¤@¤Uªº.
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

¦^´_ 10# kimbal
RUN®É¦³°ÝÃD
A1=10  E1="">RUN 2¦¸>  C1¥X1(¥¿±`C1·|¥X2 )
18-21.¨º¸Ì¬O­n   IF  ES<>"" AND V=ES  THEN....>RUN >C1=e
¥i¥H¥[¦h­Óg1   if  g1=1 ´N§â ©Ò¦³saveªºªF¦èdel. ÁÙ¦³,¦pªG§Ú³o­Óexcel¦³°ÝÃD,¥i¥H§âsaveªºªF¦ècopy¨ì²Ä2­Óexcel¶Ü?
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¥»©«³Ì«á¥Ñ kimbal ©ó 2010-7-25 14:13 ½s¿è

¦^´_ 9# basarasy

¦³Ãö"¦³¤Ö¤Ö°ÝÃD"...
  1. On Error Resume Next
  2.     Dim currRow As Long
  3.     Dim es As String
  4.     Dim e As Integer
  5.     Dim nextvalue As Integer
  6.     Dim sheetname As String
  7.     sheetname = Worksheets("entries").Name
  8.    
  9.     If sheetname = "" Then
  10.         MsgBox ("Sheet ""entries"" not found!")
  11.         Exit Sub
  12.     End If
  13.     currRow = 0
  14.    
  15.     v = Range("A1").Value
  16.     es = Range("E1").Value
  17.     e = Range("F1").Value
  18.     If es <> "" Then
  19.         v = es
  20.     Else
  21.         e = 0
  22.     End If
  23.    
  24.     currRow = WorksheetFunction.Match(v, Worksheets(sheetname).Range("A:A"), False)
  25.     With Worksheets(sheetname)
  26.         If currRow = 0 Then
  27.             currRow = .Range("A65536").End(xlUp).Row + 1
  28.             nextvalue = 1
  29.         Else
  30.             nextvalue = .Range("A1").Offset(currRow - 1, 1) + 1
  31.         End If
  32.         If e > 0 Then
  33.             nextvalue = e
  34.         End If
  35.         .Range("A1").Offset(currRow - 1, 1) = nextvalue
  36.     End With
  37.    
  38.     If currRow > 0 Then
  39.         Range("C1").Value = nextvalue
  40.     End If
½Æ»s¥N½X
Workbooks(AA).Close SaveChanges:=False
Close argument ¤Uªºfilename ¬O¥Î¨Ó«ü©wclose«á§âexcel¦s¦¨·sªºÀɦW,
¦Ó¤£¬O¥Î¨Ó«ü©wÃö¨º­Óbook
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

¦^´_ 8# kimbal


    ¦³¤Ö¤Ö°ÝÃD
§Ú·Q­n  if  e1=""   ´N¥¿±`run ,  then   if  e1=a1  f1=2(e1©Mf1³£¬O¤H¤â¥´ªº) then c1¥X2 else end
eg.

a1=30  e1="" > run > c1=1 > run > c1=2 > e1=30 f1=1 > run > c1=f1=1 > e1="" > run > c1=2

½Ð°Ý
AA = "C:\Documents and Settings\Administrator\®à­±\book.xlsm"

Workbooks.Open Filename:=AA  (³o­Ó¥i¥Hrun)

Workbooks.Close Filename:=AA , savechanges:=True  (¬°¤°»ò³o­Ó¤£¯àrun?)

test.rar (15.38 KB)

50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¥»©«³Ì«á¥Ñ kimbal ©ó 2010-7-25 09:58 ½s¿è

¦^´_ 7# basarasy


    ¦³Ãö4ªº°ÝÃD, ©ÎªÌ´«­Ó¤èªk§a
¥Î«e¤£­n§Ñ¤F¥[ entries¤@­¶
  1.     On Error Resume Next
  2.     Dim currRow As Long
  3.     Dim e As Integer
  4.     Dim nextvalue As Integer
  5.     Dim sheetname As String
  6.     sheetname = Worksheets("entries").Name
  7.    
  8.     If sheetname = "" Then
  9.         MsgBox ("Sheet ""entries"" not found!")
  10.         Exit Sub
  11.     End If
  12.     currRow = 0
  13.     v = Range("A1").Value
  14.     e = Range("E1").Value
  15.    
  16.     currRow = WorksheetFunction.Match(v, Worksheets(sheetname).Range("A:A"), False)
  17.     With Worksheets(sheetname)
  18.         If currRow = 0 Then
  19.             currRow = .Range("A65536").End(xlUp).Row + 1
  20.             nextvalue = 1
  21.         Else
  22.             nextvalue = .Range("A1").Offset(currRow - 1, 1) + 1
  23.         End If
  24.         If e > 0 Then
  25.             nextvalue = e
  26.         End If
  27.         .Range("A1").Offset(currRow - 1, 1) = nextvalue
  28.     End With
  29.    
  30.     If currRow > 0 Then
  31.         Range("C1").Value = nextvalue
  32.     End If
½Æ»s¥N½X
¦³Ãöforumlaªº°ÝÃD:
  1. Range("AA3").Formula = "=IF(" & MyName & "!C2="""","""",VLOOKUP(A2,poi!$A$2C$501,3,0))"
½Æ»s¥N½X
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

        ÀR«ä¦Û¦b : ¤H­nª¾ºÖ¡B±¤ºÖ¡B¦A³yºÖ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD