Board logo

¼ÐÃD: [µo°Ý] Excel Àɮ׳Q¨ä¥L¤H¶}±Ò [¥´¦L¥»­¶]

§@ªÌ: borshun88    ®É¶¡: 2012-11-22 20:45     ¼ÐÃD: Excel Àɮ׳Q¨ä¥L¤H¶}±Ò

Dear ¤j¤j
§Q¥Î¥Ø«eªºEXCELÀÉ®×(¨Ò¦p:¬¡­¶Ã¯1)¨Ó¶}°_¥t¤@­ÓEXCELÀÉ®×(BB)
Dim A As Workbook, B As Worksheet
Set A = Workbooks.Open(Filename:=ThisWorkbook.Path & "\bb.xlsm")
Set B = A.Sheets("¤u§@ªí1")
Range("A1") = B.Range("A1")
end sub
¦pªG¹J¨ìBBÀɮ׳Q§O¤H¶}±Ò¤¤,´N·|¥X²{°õ¦æ¿ù»~,¦Ó¦Û°Ê¶}±ÒBBÀÉ®×,
µLªk¦AÄ~Äò°õ¦æ¤U­±µ{¦¡,
¬O§_¦³¿ìªk¥i¥H¦b¤£ºÞÀɮ׬O§_¦³³Q¶}±Ò¤¤¤´¥i¥HÄ~Äò°õ¦æ¸Óµ{¦¡.
¨º­n¦p¦ó­×§ï??
ÁÂÁÂ
§@ªÌ: mark15jill    ®É¶¡: 2012-11-23 16:36

¦^´_ 1# borshun88


   
´£¨Ñµ¹±z Heish ¤j¤j¤§«e©Òµoªºµ{¦¡½X
°Ñ¦Òºô§}
http://gb.twbts.com/index.php?topic=13181.0

Sub nn()
Dim w As Window, wb As Workbook
Set d = CreateObject("Scripting.dictionary")
For Each w In Windows
¡@ d(w.Caption) = w.Caption
Next
Sheets("new").Select
¡@¡@Rows("1:1").Select
¡@¡@Selection.Copy
If d.exists("new.xls") = False Then Workbooks.Open Filename:="D:\new.xls"
Set wb = Workbooks("new.xls")
wb.Activate
¡@¡@ActiveSheet.Range("A65536").End(xlUp).Offset(1, 0).Select
¡@
¡@¡@Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
¡@¡@:=False, Transpose:=False
¡@¡@Application.CutCopyMode = False
¡@
¡@¡@wb.Save
End Sub
§@ªÌ: GBKEE    ®É¶¡: 2012-11-23 16:46

¦^´_ 1# borshun88
On Error ³¯­z¦¡ ±Ò°Ê¤@­Ó¿ù»~³B²z±`¦¡¡A¥B«ü©w¦¹±`¦¡¦b¤@­Óµ{§Çùتº¦ì¸m¡C¤]¥i¥Î¨Ó°±¤î¤@­Ó¿ù»~³B²z±`¦¡¡C
Resume ³¯­z¦¡  ¦b¿ù»~³B²z±`¦¡µ²§ô«á¡A«ì´_­ì¦³ªº°õ¦æ¡C»yªk Resume 0 Resume Next
  1. Option Explicit
  2. Sub Ex()
  3.     Dim A As Workbook, B As Worksheet
  4.     On Error Resume Next
  5.     Set A = Workbooks.Open(Filename:=ThisWorkbook.Path & "\bb.xlsm")
  6.     If Err.Number <> 0 Then
  7.         MsgBox "ÀÉ®×µLªk¶}±Ò"
  8.         Exit Sub
  9.     End If
  10.     Set B = A.Sheets("¤u§@ªí1")
  11.     Range("A1") = B.Range("A1")
  12.    
  13. End Sub
½Æ»s¥N½X

§@ªÌ: borshun88    ®É¶¡: 2012-11-23 21:38

¦^´_ 3# GBKEE
·PÁÂGBKEE¤j¤jªº¦^ÂÐ
on error resume next ¥i¥H¸Ñ¨M³o°ÝÃD
·P®¦




Åwªï¥úÁ{ ³Â»¶®a±Ú°Q½×ª©ª© (http://forum.twbts.com/)