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

[µo°Ý] ½Ð°Ý¡AFunction¤¤¡A¥Ñ©T©wÀx¦s®æ§ï¬°ÅܼÆÀx¦s®æ°ÝÃD?

[µo°Ý] ½Ð°Ý¡AFunction¤¤¡A¥Ñ©T©wÀx¦s®æ§ï¬°ÅܼÆÀx¦s®æ°ÝÃD?

  1. Public Function GetOrderText()
  2.   If Sheet1.Cells(1, 2) = "S" Then
  3.      GetOrderText = "Account=" & Sheet1.Cells(3, 2) & ",ProductID=" & Sheet1.Cells(5, 2) & ",TradeType=" & Sheet1.Cells(6, 2) & ", TradeKind=" & Sheet1.Cells(7, 2) & ", OrderType=" & Sheet1.Cells(8, 2) & ", BuySell=" & Sheet1.Cells(9, 2) & ", Qty=" & Sheet1.Cells(10, 2) & ", Price=" & Sheet1.Cells(11, 2) & ", OrderNo=" & Sheet1.Cells(12, 2) & ", TradeDate=" & Sheet1.Cells(13, 2) & ", BasketNo=" & Sheet1.Cells(14, 2)
  4. End If
  5. End Function
½Æ»s¥N½X
¥H¤W¬O­ìµ{¦¡½s½X¡A¦Ó§Ú·Q§â¨ä¤¤´X¶µ§ï¬°ÅܼơA¨Ì³yÀx¦s®æ¤£¦P¦Ó¶]¤£¦Pªº¥N¸¹

¥H¤U¬O§Ú§ï¼gªº³¡¤À
  1. Public Function GetOrderText(OrderStock As String,OrderPrice As String)
  2.   If Sheet1.Cells(1, 2) = "S" Then
  3.      GetOrderText = "Account=" & Sheet1.Cells(3, 2) & ",ProductID=" & OrderStock & ",TradeType=" & Sheet1.Cells(6, 2) & ", TradeKind=" & Sheet1.Cells(7, 2) & ", OrderType=" & Sheet1.Cells(8, 2) & ", BuySell=" & Sheet1.Cells(9, 2) & ", Qty=" & Sheet1.Cells(10, 2) & ", Price=" & OrderPrice & ", OrderNo=" & Sheet1.Cells(12, 2) & ", TradeDate=" & Sheet1.Cells(13, 2) & ", BasketNo=" & Sheet1.Cells(14, 2)
  4. End If
  5. End Function
½Æ»s¥N½X
¦pªG¥Î­ì½d¥»¡A¹q¸£¿é¥X¨ìµ{¦¡«á¨t²Î¥i¥H§P§O³o­Ó¤U³æ¦r¦ê¡A
¦ý¬O·í§Ú§â¥¦§ï¬°ÅܼƤ§«á¡A¨t²Î´NŪ¤£¨ì§Úªº¤U³æ¦r¦ê¡C

½Ð°Ý¬O§Ú¦b§â¥L§ï¬°Åܼƪº¹Lµ{¤¤¡A¦³¿òº|¤°»ò¶Ü??¥ç©Î¬O³]©w¿ù»~??
¦]¬°§Ú±µÄ²VBA¤~¤@­Ó§«ô¡A³£¬O±q¿ù»~¤¤¾Ç²ß¡A§Æ±æ¦U¦ì¥ý¶i¯à¤£§[«ü¾É!!!
ÁÂÁ¦U¦ì¥ý¶i¤F!!!

¦^´_ 1# yoya
¦ý¬O·í§Ú§â¥¦§ï¬°ÅܼƤ§«á¡A¨t²Î´NŪ¤£¨ì§Úªº¤U³æ¦r¦ê¡C

¥i¥H°Ú,
  1. Option Explicit
  2. Sub Ex()
  3.     Dim A As String, B As Boolean
  4.     'µ{¦¡¤¤¨Ï¥Î¨ç¼Æ ¦³°Ñ¼Æµ¹°Ñ¼Æ,¨S°Ñ¼Æ¤£¥Îµ¹
  5.      Sheet1.Cells(1, 2) = "S"
  6.     A = GetOrderText("²Ä¤@­Ó°Ñ¼ÆOrderStockªº¦r¦ê", "²Ä¤G­Ó°Ñ¼ÆOrderPriceªº¦r¦ê")
  7.     B = Test_Function
  8.     MsgBox A
  9.     MsgBox B
  10.     Sheet1.Cells(1, 2) = "s"
  11.     MsgBox GetOrderText("²Ä¤@­Ó°Ñ¼ÆOrderStockªº¦r¦ê", "²Ä¤G­Ó°Ñ¼ÆOrderPriceªº¦r¦ê")
  12.     MsgBox Test_Function
  13. End Sub
  14. Function Test_Function() As Boolean
  15.     If Sheet1.Cells(1, 2) = "S" Then Test_Function = True
  16. End Function

  17. Public Function GetOrderText(OrderStock As String, OrderPrice As String)
  18.     GetOrderText = "GetOrderText ???"
  19.     If Sheet1.Cells(1, 2) = "S" Then
  20.         GetOrderText = "Account=" & Sheet1.Cells(3, 2) & ",ProductID=" & OrderStock & ",TradeType=" & Sheet1.Cells(6, 2) & ", TradeKind=" & Sheet1.Cells(7, 2) & ", OrderType=" & Sheet1.Cells(8, 2) & ", BuySell=" & Sheet1.Cells(9, 2) & ", Qty=" & Sheet1.Cells(10, 2) & ", Price=" & OrderPrice & ", OrderNo=" & Sheet1.Cells(12, 2) & ", TradeDate=" & Sheet1.Cells(13, 2) & ", BasketNo=" & Sheet1.Cells(14, 2)
  21.     End If
  22. End Function
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¶â¶â~~~³o¼Ë¥i¯à¬O§Ú¦b³]­p¾ã­Óµ{¦¡ªº®É­Ô~~ÅÞ¿è¤W¥X¤F°ÝÃD~~
«D±`·PÁÂÁª©¥Dªº¦^ÂЭò!!!!!

TOP

        ÀR«ä¦Û¦b : ¨ü¤HÂI¤ô¤§®¦¡A¶··í´é¬u¥H³ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD