¼ÐÃD:
MsgBox ªº°ÝÃD
[¥´¦L¥»¶]
§@ªÌ:
jesscc
®É¶¡:
2011-5-7 12:25
¼ÐÃD:
¶}±Ò¥t¥~¤@Ó¬¡¶Ã¯
¥»©«³Ì«á¥Ñ jesscc ©ó 2011-5-7 12:31 ½s¿è
½Ð±Ð¦U¦ì¥ý¶i¤@Ó°ÝÃD¡A§Ún¦bMain¬¡¶Ã¯¤¤«ö"¶}Àɤñ¹ï"«ö¶s¶}±Ò¥t¥~¤@Ó¬¡¶Ã¯Matl Request *.xls(*¥Nªí¤£¦Pªº¤é´Á)
1.¦pªG"Matl Request *.xls"©|¥¼¶}±Ò¡A´N¦b "¶}±ÒÀÉ®×¹ï¸Ü®Ø" ¤¤±N¥¦¶}±Ò¡A¶¶«K§âÀɦW¶K¦bMain¬¡¶Ã¯¤¤ªºRange("D1")¡A¥H«K«áÄòµ{¦¡¥Ñ¦¹¨ú±oÀɦW¡A¶i¦æ¬ÛÃö¤u§@(Workbooks(Workbooks("Main").Sheets("MRP").[D3].Text).Sheets("sheet1").Range("B11:N22").Copy Workbooks("Main").Sheets("MRP").Range("B11:N22"))¡C
2.¦pªG"Matl Request *.xls"¤w¶}±Ò¡A´N¤£¥ÎÅã¥Ü "¶}±ÒÀÉ®×¹ï¸Ü®Ø" ª½±µ§ì¨ú³oÓÀɦW¶K¦bMain¬¡¶Ã¯¤¤ªºRange("D1")¡A¥H«K«áÄòµ{¦¡¥Ñ¦¹¨ú±oÀɦW¡A¶i¦æ¬ÛÃö¤u§@¡C
¥i¬O§Úªº¼gªk¦n¹³¨S¤°»ò§@¥Î¡A¤£ª¾¹D°ÝÃD¦bþ¸Ì?¥i¥HÀ°§Ú¬Ý¬Ý¶Ü?ÁÂÁÂ!
[attach]6028[/attach]
§@ªÌ:
Hsieh
®É¶¡:
2011-5-7 13:40
¦^´_
1#
jesscc
Sub OpenFile1()
FileToOpen = Application.GetOpenFilename _
(Title:="¶}±Ò¥»¶g»Ý¨Dªí", _
FileFilter:="Matl Request *.xls (*.xls),")
If FileToOpen = False Then
MsgBox "¥²¶·¶}±Ò »Ý¨Dªí¡A¤u§@¤~¯àÄ~Äò!", 48, "ÀÉ®×¥¼¶}±Ò"
Exit Sub
Else
op = False
fn = Split(FileToOpen, "\")(UBound(Split(FileToOpen, "\")))
Var = MsgBox("½T©w¬O¶}±Ò³o¥÷»Ý¨Dªí¶Ü?", 36, "½Ð½T»{±ý¶}±Ò¤§ÀÉ®×")
If Var = 6 Then
For Each w In Windows 'ÀˬdÀɮ׬O§_¤w¶}±Ò
If w.Caption = fn Then op = True: Exit For
Next
If op = False Then Workbooks.Open Filename:=FileToOpen '¦pªGµøµ¡¤¤¨S¦³¶}±Ò»Ý¨Dªí´N¶}±Ò»Ý¨Dªí
Set aw = Workbooks(fn) '±N»Ý¨Dªí³]µ¹ª«¥óÅܼƥH§Q«áÄò¨Ï¥Î
Workbooks("Main.xls").Activate
Sheets("MRP").Range("D1").Value = fn '±N»Ý¨DªíÀɦW¼g¤JÀx¦s®æ
Else
End If
End If
End Sub
½Æ»s¥N½X
§@ªÌ:
GBKEE
®É¶¡:
2011-5-7 14:16
¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-5-7 14:32 ½s¿è
¦^´_
1#
jesscc
¥i¬O§Úªº¼gªk¦n¹³¨S¤°»ò§@¥Î¡A¤£ª¾¹D°ÝÃD¦bþ¸Ì?
Sub OpenFile1()
FileToOpen = Application.GetOpenFilename _
(Title:="¶}±Ò¥»¶g»Ý¨Dªí", _
FileFilter:="Matl Request *.xls (*.xls),")
If FileToOpen = False Then
MsgBox "¥²¶·¶}±Ò »Ý¨Dªí¡A¤u§@¤~¯àÄ~Äò!", 48, "ÀÉ®×¥¼¶}±Ò"
Exit Sub
Else
Var
= MsgBox("½T©w¬O¶}±Ò³o¥÷»Ý¨Dªí¶Ü?", 36, "½Ð½T»{±ý¶}±Ò¤§ÀÉ®×")
'No ->
Var
=7
'Yes->
Var
=6
If
Var = 6
Then
Workbooks.Open Filename:=FileToOpen
Workbooks("Main.xls").Activate
Sheets("MRP").Range("D1").Value =
FileToOpen
Else
End If
End If
End Sub
MsgBox «öÁä§PÂ_
Sub Ex()
A = MsgBox("½T©w¬O¶}±Ò³o¥÷»Ý¨Dªí¶Ü?", vbYesNoCancel, "½Ð½T»{±ý¶}±Ò¤§ÀÉ®×")
If A = vbYes Then
MsgBox "¶}±ÒÀÉ®×"
ElseIf A = vbNo Then
MsgBox "¤£¶}±ÒÀÉ®×"
ElseIf A = vbCancel Then
MsgBox "¨ú®ø"
End If
End Sub
½Æ»s¥N½X
§@ªÌ:
jesscc
®É¶¡:
2011-5-7 14:33
ì¨Ó³o»ò½ÆÂø¡A¥»¨ÓÁÙ¥H¬°¬O«Ü²³æªº°Ê§@©O?
·PÁÂ Hsieh ¤j!
¤£¹Lèè´ú¸Õ¡AÁÙ¬O¦³¤@ÂI¤p°ÝÃD¡C¦pªG§Ú¤w¸g¥ý¥´¶}¤FMatl Request *.xls¡AµM«á¤~¦bMain¬¡¶Ã¯¤¤«ö"¶}Àɤñ¹ï"«ö¶s¡Aµ²ªGÁÙ¬O·|¥X²{ "¶}±ÒÀÉ®×¹ï¸Ü®Ø" ¡A¦b³oºØ±¡§Î¤U¥i¥H²¤¹L"¶}±ÒÀÉ®×¹ï¸Ü®Ø"¡Aª½±µ¸õ¨ì§Úªº¤u§@¶Ü?
§@ªÌ:
Hsieh
®É¶¡:
2011-5-7 14:42
¥»©«³Ì«á¥Ñ Hsieh ©ó 2011-5-7 14:46 ½s¿è
¦^´_
4#
jesscc
¨º§A«ç»òÅýµ{¦¡ª¾¹D§A·Q¶}ªºÀɦW¬O¬Æ»ò?
¨Ò¦p¤w¦³2Ó¤£¦P¤é´ÁªºÃþ¦üÀɦW¡An¥Îþ¤@Ó?
§@ªÌ:
jesscc
®É¶¡:
2011-5-7 15:17
¥»©«³Ì«á¥Ñ jesscc ©ó 2011-5-7 18:23 ½s¿è
»¡±o¤]¬O¡A§Ú¤£ª¾¤£Ä±´N§â¤Hªº«ä¦Ò±a¶i¹q¸£ùؤF¡C
Hsieh ¤j¤j¥i¥H¦AÀ°§Ú¬Ý¤@¤U¶Ü?
¦b³Ì«á¡A°}¦CÂಾ»Ý¨Dªí¸ê®Æªº¦a¤è¥X²{°»¿ù!¥i¤£¥i¥HÀ°§ÚÀˬd¤@¤U¬Oþ¸Ì¿ù¤F¶Ü?¬O¦]¬°°}¦CµLªkÂಾ»Ý¨Dªíùتº¤½¦¡¶Ü?
Sub OpenFile1()
FileToOpen = Application.GetOpenFilename _
(Title:="¶}±Ò¥»¶g»Ý¨Dªí", _
FileFilter:="Matl Request *.xls (*.xls),")
If FileToOpen = False Then
MsgBox "¥²¶·¶}±Ò »Ý¨Dªí¡A¤u§@¤~¯àÄ~Äò!", 48, "ÀÉ®×¥¼¶}±Ò"
Exit Sub
Else
op = False
fn = Split(FileToOpen, "\")(UBound(Split(FileToOpen, "\")))
'Var = MsgBox("½T©w¬O¶}±Ò³o¥÷»Ý¨Dªí¶Ü?", 36, "½Ð½T»{±ý¶}±Ò¤§ÀÉ®×")
'If Var = 6 Then
For Each w In Windows 'ÀˬdÀɮ׬O§_¤w¶}±Ò
If w.Caption = fn Then op = True: Exit For
Next
If op = False Then Workbooks.Open FileName:=FileToOpen '¦pªGµøµ¡¤¤¨S¦³¶}±Ò»Ý¨Dªí´N¶}±Ò»Ý¨Dªí
Set aw = Workbooks(fn) '±N»Ý¨Dªí³]µ¹ª«¥óÅܼƥH§Q«áÄò¨Ï¥Î
Workbooks("Main.xls").Activate
Sheets("MRP").Range("D1").Value = fn '±N»Ý¨DªíÀɦW¼g¤JÀx¦s®æ
'Else
End If
'°}¦CÂಾ»Ý¨Dªí¸ê®Æ
Workbooks(fn).Activate
Dim Ay()
For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
For j = 2 To 14
ReDim Preserve Ay(s)
Ay(s) = Array(Cells(i, j).Value)
s = s + 1
Next j
Next i
Workbooks("Main.xls").Activate
With Sheets("MRP")
Cells(4, 14).NumberFormat = "dd/mm/yyyy"
Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).Resize(s, 13) = Application.Transpose(Application.Transpose(Ay))
End With
End sub
½Æ»s¥N½X
§@ªÌ:
Hsieh
®É¶¡:
2011-5-7 18:15
aw.Sheets("sheet1").[B11:N22].Copy Workbooks("Main").Sheets("MRP").[B11:N22]
§@ªÌ:
jesscc
®É¶¡:
2011-5-13 00:34
¼ÐÃD:
MsgBox ªº°ÝÃD
¥»©«³Ì«á¥Ñ jesscc ©ó 2011-5-13 00:48 ½s¿è
¥H¤U¥N½X¡A·Q°µªº°Ê§@¬O:
«ö"½T©w"·|§R°£Range("B7:J1000")ªº¸ê®Æ¡A«ö¤U"¨ú®ø"´N°h¥Xµ{¦¡¡A¤£°µ°Ê§@¡C
¥i¬O¤£ºÞ§Ú«öþ¤@Ó³£¨S¦³§@¥Î¡A¬Oþ¸Ì¦³¿ù¶Ü?
Sub Macro1()
MsgBox "³o¼Ë°µ·|²M°£ NEW ¤u§@¶ªº¸ê®Æ!" & vbCrLf & vbCrLf & "§A½T©wn³o¼Ë°µ¶Ü?", vbOKCancel + vbQuestion, "²M°£ NEW ì©l¸ê®Æ!"
If Var = 1 Then
Worksheets("NEW").Range("B7:J1000").ClearContents
End If
If Var = 2 Then
Exit Sub
End If
End Sub
½Æ»s¥N½X
Åwªï¥úÁ{ ³Â»¶®a±Ú°Q½×ª©ª© (http://forum.twbts.com/)