杌㈣鍏堛伄銈楓兗銉?/span>
sakiSH.Range("A4:O1000").ClearContents
sakiSH.Range("A4:O1000").Clear
Set sakiSH = Nothing
End Function
'/////////////////////////////////////////////////////////////
'paintCellsLine
'浣褲亜鏂癸細(xì)
' Dim startCell As Range
' Dim endCell As Range
' Set startCell = Workbooks(1).Sheets(2).Cells(4, 1)
' Set endCell = Workbooks(1).Sheets(2).Cells(48, 9)
' Call paintCellsLine(startCell, endCell)
'@param startCell
'@param endCell
'/////////////////////////////////////////////////////////////
Function paintCellsLine(startCell As Range, endCell As Range)
With Range(startCell, endCell)
For i = 7 To 12
.Borders(i).LineStyle = xlContinuous
Next
End With
End Function
VBA榪濪B
Dim sqlStr As String
sqlStr = getSqlStr()
Dim connection As New ADODB.connection
Dim resultSet As ADODB.recordSet
Dim connStr As String
connStr = "Provider=SQLOLEDB;Server=127.0.0.1;Database=BMS;Trusted_Connection=yes;Uid=sa;Pwd="
connection.Open connStr
Set resultSet = New ADODB.recordSet
resultSet.Open sqlStr, connection
Dictionary鐨勪嬌鐢紙add Microsoft Scripting Runtime.錛?
Dim dict
' 鍒涘緩Dictionary
Set dict = CreateObject("Scripting.Dictionary")
' 澧炲姞欏圭洰
dict.Add "A", 300
dict.Add "B", 400
dict.Add "C", 500
' 緇熻欏圭洰鏁?/span>
n = dict.Count
' 鍒犻櫎欏圭洰
dict.Remove ("A")
' 鍒ゆ柇瀛楀吀涓槸鍚﹀寘鍚叧閿瓧
dict.exists ("B")
' 鍙栧叧閿瓧瀵瑰簲鐨勫鹼紝娉ㄦ剰鍦ㄤ嬌鐢ㄥ墠闇瑕佸垽鏂槸鍚﹀瓨鍦╧ey錛屽惁鍒檇ict涓細(xì)澶氬嚭涓鏉¤褰?/span>
Value = dict.Item("B")
' 淇敼鍏抽敭瀛楀搴旂殑鍊?濡備笉瀛樺湪鍒欏垱寤烘柊鐨勯」鐩?/span>
dict.Item("B") = 1000
dict.Item("D") = 800
' 瀵瑰瓧鍏歌繘琛屽驚鐜?/span>
k = dict.keys
v = dict.Items
For i = 0 To dict.Count - 1
key = k(i)
Value = v(i)
MsgBox key & Value
Next
' 鍒犻櫎鎵鏈夐」鐩?/span>
dict.Removeall
VBA緙栫▼榛勯噾娉曞垯錛?br />
褰曞埗瀹忥紝淇敼褰曞埗鐨勫畯涓哄繁鎵鐢?br />

]]>