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

[µo°Ý] ~ µo²{¤@­Ó·sªº°ÝÃD Ãö©óIF§PÂ_¦¡

¦^´_ 26# opelwang


    À³¸Ó¬O¥´¿ù¦r¤F, ¥¿½T¬O:

     ¾Ç²ßVBAªº¥Îªk.

TOP

¦^´_ 29# GBKEE


   ª©¥D§Ú³Ìªñ­«·s½m²ß¤Sµo²{¤F¤@­Ó°ÝÃD¡A´N¬O¦pªG§Ú·Q­n¦h§PÂ_C10 »P C12 ,¤]´N¬O¦P®É¥i¯à¨â­Ó¥D¿ì¨â­Ó¨ó¿ì¡A
¯à¦b'For Each E In Sh.Range("B10,B12")' ³oÃ䪽±µ´¡¤J'For Each E In Sh.Range("B10,B12,C10,C12") ¶Ü??'
¨º§Ú¦b¤U­±IF§PÂ_¦¡¸Ó¦p¦ó­×§ï??
Åã¥Üªº¦ì¤l³£¤£ÅÜ¥u¬O¦h§PÂ_Àx¦s®æC10»PC12

TOP

¦^´_ 32# willy1205


    ¸Õ¤F¤@¤U¦n¹³¨S¿ìªkª½±µ¥[¤JC10 C12,¥B¤U­±§PÂ_¦¡·|¥d¦º...

TOP

ª©¥D¦³¤èªk¥i¥H ¸Ñ¨M¶Ü!?

TOP

[µo°Ý] ~ µo²{¤@­Ó·sªº°ÝÃD Ãö©óIF§PÂ_¦¡

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-5-22 16:40 ½s¿è

§Ú³Ìªñ¤S­«·s±Nµ{¦¡®³¥X¨Ó½m²ß¡A­ì¥»§PÂ_¦¡¬O§PÂ_B10»PB12¡A
§Úµo²{¦pªG¤µ¤Ñ§Ú·Q­n¦h§PÂ_C10»PC12¡A¬Æ¦ÜD10»PD12¡A¤£ª¾¹D¸Ó±q­þÃä´¡¤JIF§PÂ_¦¡¡A
For Each E In Sh.Range("B8,B10") ³oÃä¦n¹³¨S¿ìªkª½±µ§ï¦¨ For Each E In Sh.Range("B8,B10,C10,C12")
¦³¿ìªk¯à¦h§PÂ_C10»PC12¶Ü??

¥I¤W­ì©«ªº³sµ² http://forum.twbts.com/viewthrea ... p;extra=&page=3
ª©¥Dµ¹ªºµ{¦¡½X
Dim NewRow As Integer, E As Range, Sh As Worksheet
Set Sh = Worksheets("4-¤u§@¤é»xOP COA AGR")
For Each E In Sh.Range("B10,B12")
If E.Address = "$B$10" Then
            NewRow = Sh.Range("J34").Value
        Else
            NewRow = Sh.Range("J35").Value
        End If
        
With Worksheets(E.Value)
            
.Cells(NewRow, 1) = Sh.Range("C7")
            
.Cells(NewRow, 2) = Sh.Range("C8").Value
            
.Cells(NewRow, 3) = Sh.Range("I14").Value
            
.Cells(NewRow, 4) = Sh.Range("I15").Value
            
.Cells(NewRow, 6) = Sh.Range("G24").Value
            
If E.Address = "$B$10" Then
               
.Cells(NewRow, 7) = Sh.Range("H32")
.Cells(NewRow, 5) = Sh.Range("J10").Value
               
Sh.Range("J34") = NewRow
            
Else

.Cells(NewRow, 7) = Sh.Range("H34")
.Cells(NewRow, 5) = Sh.Range("J12").Value
               
Sh.Range("J35") = NewRow
            
End If
        
End With
   
Next
    MsgBox "New Data added", vbOKOnly, "Data"

End Sub

¦^´_ 35# willy1205
  1. Sub Ex()
  2. Dim E, NewRow
  3. For Each E In Range("B8,B10,C10,C12")
  4.     Select Case E.Address(0, 0)
  5.     Case "B8"
  6.         NewRow = 1
  7.     Case "B10"
  8.         NewRow = 2
  9.     Case "C10"
  10.         NewRow = 3
  11.     Case "C12"
  12.         NewRow = 4
  13.     End Select

  14.     MsgBox NewRow
  15. Next
  16. End Sub
  17. Sub Ex1()
  18. Dim E, NewRow
  19. For Each E In Range("B8,B10,C10,C12")
  20.     If E.Address(0, 0) = "B8" Then
  21.         NewRow = 1
  22.     ElseIf E.Address(0, 0) = "B10" Then
  23.         NewRow = 2
  24.     ElseIf E.Address(0, 0) = "C10" Then
  25.         NewRow = 3
  26.     ElseIf E.Address(0, 0) = "C12" Then
  27.         NewRow = 4
  28.     End If
  29.     MsgBox NewRow
  30. Next
  31. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 36# GBKEE


   ª©¥DÁÂÁ§A¡A½Ð°Ý¦pªG­n§â¥L¼g¦b¦P¤@­Ó«ö¶s¥¨¶°¸Ì­±³o¦³¿ìªk¶Ü??

TOP

¦pªG±N­ì¥»ªº
For Each E In Sh.Range("B10,B12")
If E.Address = "$B$10" Then
            NewRow = Sh.Range("J34").Value
        Else
            NewRow = Sh.Range("J35").Value
        End If
§ï¦¨
For Each E In Range("B10,B12,C10,C12")
    Select Case E.Address(0, 0)
    Case "B10"
        NewRow = 1
    Case "B12"
        NewRow = 2
    Case "C10"
        NewRow = 3
   Case "C12"
NewRow = 4
    End Select
¤U­±ªºWith Worksheets(E.Value)·|Åܦ¨out of range

¸Ó¦p¦ó­×§ï?

TOP

¦^´_ 38# willy1205

excercise.zip (64.56 KB)

¦p½m²ß³o­ÓÀɮסA­ì¥»¬O§PÂ_B10»PB12(A§g»PB§g)µM«á«ö¤U«ö¶s¶×¤J¸ê®Æ¶i¥hA§g»PB§gªºSHEET¡A
²{¦b·Q¦bC10»PC12¡AD10»PD12¤À§O¥[¤JC§g D§g F§g E§gªº¸Ü¡A¸Ó«ç»ò´¡¤J¶i¥h§PÂ_¦¡©O??

TOP

¦^´_ 39# willy1205


  ½Ð°Ýª©¥D¦³«Øij¶Ü?? ÁÂÁÂ

TOP

        ÀR«ä¦Û¦b : ¬Ý§O¤H¤£¶¶²´¡A¬O¦Û¤v­×¾i¤£°÷¡C
ªð¦^¦Cªí ¤W¤@¥DÃD