-
- Function ConvertExcelNumToInt(colName As String) As Integer
- Dim i As Integer
- Dim rtn As Integer
- If Len(colName) = 0 Then
- ConvertExcelNumToInt = 0
- Exit Function
- End If
- colName = UCase(colName)
- rtn = 0
- For i = 1 To Len(colName)
- rtn = rtn * 26
- rtn = rtn + Asc(Mid(colName, i, 1)) - 64
- Next
- ConvertExcelNumToInt = rtn
- End Function
- Function ConvertToLetter(iCol As Integer) As String
- Dim iAlpha As Integer
- Dim iRemainder As Integer
- iAlpha = Fix(iCol / 26)
- iRemainder = iCol - (iAlpha * 26)
- If iAlpha > 0 Then
- If iRemainder = 0 Then
- iAlpha = iAlpha - 1
- iRemainder = 26
- End If
- If (iAlpha > 0) Then
- ConvertToLetter = Chr(iAlpha + 64)
- End If
- End If
- If iRemainder > 0 Then
- ConvertToLetter = ConvertToLetter & Chr(iRemainder + 64)
- End If
- End Function
- Function GetAutoFilterResult(sh As Worksheet) As VBA.Collection
- Dim rtn As New VBA.Collection
- Dim curCell As Range
- countchange = WorksheetFunction.Subtotal(3, sh.AutoFilter.Range)
- If (countchange = sh.AutoFilter.Range.Columns.Count) Then
- Exit Function
- End If
- Set curCell = sh.Cells(sh.AutoFilter.Range.Row + 1, 1)
- While Not IsEmpty(curCell)
-
- If curCell.RowHeight > 0 Then
- rtn.Add (curCell.Row)
- End If
- Set curCell = curCell.Offset(1, 0)
- Wend
- Set GetAutoFilterResult = rtn
- End Function
- '记事..
- Sub dictionarySample()
- Dim dic
- Dim d As New VBA.Collection
-
-
- d.Add ("1")
-
- d.Remove (1)
-
- Set dic = CreateObject("scripting.dictionary")
-
-
- dic.Add "key", "Dictionary"
- s = dic.Item("key")
-
-
-
-
-
-
-
-
-
-
- End Sub
posted @
2008-10-22 16:39
四六成双
阅读(
402)
评论()
编辑
收藏
举报