有人能用英语为我解释这个VBA宏代码吗?

时间:2016-09-08 08:08:04

标签: excel vba excel-vba macros

Sub Seperate_Item_Codes_and_Descriptions()

'Seperate the item codes and the descriptions and put them in respectively in columns D and E.

Dim s As Long, a As Long, aVALs As Variant

With Worksheets(1)
    aVALs = .Range(.Cells(12, "B"), .Cells(.Rows.Count, "B").End(xlUp)).Value2
    ReDim Preserve aVALs(LBound(aVALs, 1) To UBound(aVALs, 1), 1 To 2)
    For a = LBound(aVALs, 1) To UBound(aVALs, 1)
        s = InStr(1, aVALs(a, 1), Chr(32))
        aVALs(a, 2) = Mid(aVALs(a, 1), s + 1)
        aVALs(a, 1) = Left(aVALs(a, 1), s - 1)
    Next a
    .Cells(12, "D").Resize(UBound(aVALs, 1), UBound(aVALs, 2)) = aVALs
End With

End Sub

1 个答案:

答案 0 :(得分:5)

有点懒惰......只需阅读代码:

<script src="jquery.min.js"></script>

<script >
 function button(){
    //your ajax code for sending data  
  /*  function retrieveData(){
        $.post('server.php',{}, function(data){ 
   });*/

   $("#button").attr('value', 'Sent');
   $("#button").css("background-color","red")
}
</script>

<input type="button" id="button" name="button" value="Send" onclick="button()">