- ©«¤l
- 27
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 69
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- office 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-4-19
- ³Ì«áµn¿ý
- 2012-6-26
|
¥»©«³Ì«á¥Ñ atuan207 ©ó 2011-4-25 21:50 ½s¿è
oobird¤j¤j§Ú·Q½Ð±Ð¤@¤Uµ{¦¡
¦]¬°§Ú¥¿¦b¦Û¾ÇVBA¤¤¡A©Ò¥H¥i¯à¦³¨ÇÅܼƩM¥Îªk¤£¬O¨º»ò¼ô±x¡C
·Q¸ÕµÛ°µµù¸ÑÅý¦Û¤v§óÆ[©À¯à²M·¡
¤U±§Ú¸ÕµÛµù¸Ñ¨Ó½Ð±Ð
Sub yy()
Dim c As Range, i%
// ³oÓi%¦³ÂI¤£¤ÓÀ´¡A¦ý¬O¸ÕµÛÅý¥L¿é¥X«á¡A¥i¥Hª¾¹D¬O§Ú¦³´XÓÈ¡A¥¦«K·|¬O´XÓÈ
(©Ò¥HÀ³¸Ó¬OºâÅܼƦ³´Xµ§¡A¨Ã©M¦ì¸m°µ³sµ²EX (i,2) ´N¬O(1,2)¡B(2,2)....¤@ª½¤U¥h)
With Sheet1
// with¬O¦P¼ËªºªF¦è°µºë²¡A©Ò¥H«á±¥un¬O"sheet1."¤°»òªº³£¥un¥Î".¤°»òªí¥Ü"
For i = 2 To .[a65536].End(3).Row
//For ªìÈ To ¨ì µ²§ôªºÈ ¦ý¤£À´«á±³o .End(3).Row³oÃä¬O°µ¤°»ò¥Îªº
Set c = Sheet2.[a:a].Find(.Cells(i, 2))
//°t¦XNothingªº¥Îªk¡Aset ½d³òA = ¬Û¥æªº½d³ò
//¤£ª¾¹D³o¼Ë¸ÑÄÀ¹ï¤£¹ï sheet2[a:a] ¤¤ªºÈ¡A¥h§ä(sheet1.cells(i,2))¤¤ªºÈ
//¦ý¬Osheet2[a:a] §Ú¤£À´[a:a]ªº¥Îªk
If Not c Is Nothing Then
.Cells(i, 3).Resize(, 2) = c(1, 2).Resize(, 2).Value
//¦pªG¨S¦³©Mcªº¤@¼Ëªºµ²ªG¡A
//¨º»ò±N§âÈ©ñ¦^Sheet1ªº²ÄC¦æ¡A.Resize(, 2) ³o§Ú¤£À´¬O¤°»ò ©Ò¥H«á±´N¤£À´¤F
End If
Set c = Sheet3.[a:a].Find(.Cells(i, 1))
//¤ñ¹ï§¹Sheet2´«Sheet3
If Not c Is Nothing Then
.Cells(i, 5).Resize(, 3) = c(1, 2).Resize(, 3).Value
End If
Next
End With
End Sub
¥H¤U¬O§â·Q°Ýªº·J¾ã¤@¤U
Q1: i%ªº¥Îªk©M§Ú·Qªº¤@¼Ë¶Ü???¡A¨º"ÅܼÆ%"ªº¥Îªk¬O¤°»ò°Ú??
Q2: .End(3).Row³oÃä¬O°µ¤°»ò¥Îªº???
Q3: [a:a]ªº¥Îªk
Q4: .Resizeªº¥Îªk
Q5: °õ¦æ«á·|¥X²{³o¼ËªºÄµ§i¡A§Ú¸Ó¦p¦ó¦sÀÉ·|¤ñ¸û¦n?
¤j·§³o¤Ó°ÝÃD
§Ú¦Û¤v¦³µy·Lgoogle¤@¤U¡A¦ý¬O¹³Q4§ä¥X¨Óªºµ²ªG¬Ý¤FÁÙ¬O¤£¤ÓÀ´¡A
¦Ó¥B¤âÃ䪺®Ñ¥»¦n¹³¤]¨S¦³´£¨ì¡A©Ò¥H·Q½Ð±ÐªO¤Wªº¤j¤j
³Â·Ð¤F~~ |
|