- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 14
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-6
|
¥»©«³Ì«á¥Ñ luhpro ©ó 2014-9-20 04:50 ½s¿è
¤£¦n·N«ä¡B½Ð°Ý«e½ṳ́@¤U~
¤p§Ì¦¹vba¥\¯à¬°°w¹ï¦P¤@Ó¸ê®Æ§¨¤Uªº©Ò¦³excel¤¤ªº(Sheet1)ªº²Ä9~14Äæ¦ì¶i¦æ³] ...
ii31sakura µoªí©ó 2014-9-17 17:56
¥H¤U¬OÓ¤Hªº²L¨£,§A¥i¥H°Ñ¦Ò¬Ý¬Ý:
1. °ò¥»¤Wn¹ïÀÉ®× "¤º®e" §@ÅܧóÀ³¸Ó³£¬On¥ý¶}Àɪº,
°£«D§A¬O¥Î¦´ÁDOS®É¥N§C¶¥¼g¤JºÏºÐ¸ê®Æªº¤è¦¡¨Óª½±µ¼g¤JºÏ±,
¦ý³o¨Ã¤£·|³QWindows¨t²Î±µ¨ü,
¤]´X¥G·|³QÂk¤J¬O¯f¬rªº¦æ¬°.
2. µ½¥Î With...End With ¨Ó¨ú¥N»Ý "³Q«½Æ¨Ï¥Î" ªº "ª«¥ó",
µ½¥Î "ÅܼÆ" ¨Ó¨ú¥N»Ý "³Q«½Æ¨Ï¥Î" ªº "pºâµ²ªG",
¤×¨ä¬O For...Next ©Î Do...Loop ...µ¥°j°é¤¤¸g±`·|°Ñ¦Ò¨ìªºªF¦è,
³t«×¸û§Ö¤]¦³§Q©óµ{¦¡½Xªº¿ëÃÑ»P°£¿ù,
·íµMY¥u¨Ï¥Î¤@¦¸, ¨º´N§O¥Î¤F.
3. °£«D¥²»Ýn¥Î¨ì(¨Ò¦p¨Ï¥ÎªÌ»Ýn¬Ý¨ì, ©Î¬Y¨Ç»Ýn°Ñ·Ó¨ì²{¥Îª«¥óªº±MÄÝ«ü¥O½X),
§_«h Select ©Î Activate «ü¥O½Ð¾¨¶q¤Ö¥Î,
¨º·|®ö¶O¤@¨Ç«D¥²nªº®É¶¡(¤×¨ä¬O¦b°j°é¤¤, ·|«½Æ°õ¦æ«Ü¦h¦¸ªº±¡§Î).
4. µ{¦¡½X¥i¥H¾A·í¨Ï¥ÎÁY±Æ(¥ªºÝ¥[ªÅ®æ)»PªÅ¥Õ¦æ, ¼W¥[¿ëÃÑ»P°£¿ùªº«K§Q©Ê.
µ{¦¡×§ï¦p¤U,¦]µL¸ê®Æ¥i¥H¥ý¦æ´ú¸Õµ²ªG,Y¦³°ÝÃD¦A½Ð´£¥X:- Sub ¼Ð®×¦WºÙÂà´«()
- With Sheets("别Ǧ")
- .[a2:a65535].ClearContents
- .Cells(1, 2) = ActiveWorkbook.Path
- fs = Dir(.Cells(1, 2) & "\*.*")
- Do Until fs = ""
- r = r + 1
- .Cells(r + 1, 1) = fs
- fs = Dir
- Loop
- End With
- End Sub
- Sub ¼Ð®×¦WºÙÂà´«1() '§R°£¨ä¥¦«DexcelÀÉ®×
- Dim LastRow As Long, r As Long
- '§PÂ_³Ì«á¨Ï¥Îªº¦C¡A±N³oÓ¦C¼Æ«ü¬£µ¹ LastRow ÅܼÆ
- With Worksheets("别Ǧ")
- LastRow = .UsedRange.Rows.Count
- 'LastRow ªºpºâ¤è¦¡¡G§PÂ_¨Ï¥Î½d³ò¤¤ªº¦C¼Æ¡A¥[¤W¨Ï¥Î½d³ò¤¤²Ä¤@Ó¦C¼Æ¡A¦A´î¥h 1
- LastRow = LastRow + .UsedRange.Row - 1
- Application.ScreenUpdating = False
- '°j°é¨Ï¥Î Step -1 ·|¥Ñ¤U¦Ó¤W¶i¦æ³B²z¡A·í§R°£¦C¤§«á·|±N©Ò¦³¤U¤èªº¦C©¹¤W²¾°Ê¡C
- '¦¹°Ï¶ô¬°§R°£"«Dxl*ÀÉ"
- For r = LastRow To 2 Step -1
- If .Cells(r, 1) Like "*xl*" Then
- Else
- .Rows(r).Delete
- End If
- Next r
- '¦¹°Ï¶ô¬°§R°£"Âà´«testÀÉ "¦r¦C
- For r = LastRow To 2 Step -1
- If .Cells(r, 1) Like "Âà´«testÀÉ*" Then .Rows(r).Delete
- Next r
- End With
- End Sub
- Sub Äæ¦ìÂà´«()
- Dim lRows&
- Dim wb As Workbook
-
- Application.DisplayAlerts = False '¬O¥Î¨Ó²¤¹L§R°£®É´£¿ôªº¹ï¸Ü¤è¶ô, YÁÙn½T»{, «h¥i¤£¥Î¦¹«ü¥O
- With ThisWorkbook.Worksheets("别Ǧ")
- lRows = .[a65536].End(3).Row
- For i = 2 To lRows
- Set wb = Workbooks.Open(.Cells(1, 2) & "\" & .Cells(i, 1))
- wb.Worksheets("Sheet1").Rows("9:14").RowHeight = 13.5
- wb.Close True
- Next
- End With
- Application.DisplayAlerts = True
- Set wb = Nothing
- End Sub
- Sub ¸ê®ÆÁ`©I¥s()
- Call ¼Ð®×¦WºÙÂà´«
- Call ¼Ð®×¦WºÙÂà´«1
- Call Äæ¦ìÂà´«
- End Sub
½Æ»s¥N½X |
|