随笔分类 - VBA资料
为自己做点笔记
摘要:Function FindCellByText(searchRange As Range, searchText As String) As Range ' 功能:在指定列中查找包含特定文本的单元格 ' 参数: ' searchRange - 要搜索的列范围 ' searchText - 要查找的文
阅读全文
摘要:View Code Sub GetSameValue()Dim arr(0)Dim i As Integer, cellval As Integer, tempval As IntegerDim varstr As Stringarr(0) = Array(9, 1, 4, 6, 1, 1, 1, 1)For i = 0 To UBound(arr(0)) cellval = arr(0)(i) If i = 0 Then tempval = cellval Else If cellval < tempval Then tem...
阅读全文
摘要:View Code Public Function GetColName(ByVal strAddress As String, ByVal Start As Integer) As String' Dim strAddress As String Dim endP As Integer' strAddress = ActiveCell.Address' endP = InStr(2, strAddress, "$") endP = InStr(Start, strAddress, "$") GetColName = SubStr
阅读全文
摘要:'类模块---》添加类名为“CCB”的类,代码如下:Option ExplicitPrivate WithEvents m_CB As MSForms.CheckBox Private m_Form As WorksheetPublic Sub Init(ctl As MSForms.CheckBox, frm As Worksheet)Set m_CB = ctlSet m_Form = frmEnd SubPrivate Sub m_CB_Click()Dim KPIName As StringDim startNo As Long, endNo As LongDim objshe
阅读全文
摘要:Public Sub aa()Dim xc(1) As Variantxc(0) = Array(49, 132, 155)xc(1) = Array(146, 208, 80)RangeColorSort Sheets("Sheet1"), Sheets("Sheet1").Range("F2:F15"), Sheets("Sheet1").Range("F2:F15"), xcEnd SubPublic Sub RangeColorSort(sourceSheet As Worksheet,
阅读全文
摘要:Sub ReadFilesInFolder() Dim filePath As String Dim otherExcelFileName As String Dim wb As Workbook 'Excel.Application.DisplayAlerts = False Excel.Appl
阅读全文


浙公网安备 33010602011771号