12 2022 档案
摘要:利用VBA快速处理EXCEL、CSV数据 超简代码 - 知乎 (zhihu.com)
阅读全文
摘要:来源:利用VBA字典实现单条件,结果多值查询 - 知乎 (zhihu.com) 很好的利用字典数据类型 利用VBA字典实现单条件,结果多值查询 VBA语言专业教育 分享成果,随喜正能量 7 人赞同了该文章 大家好,今日我们继续讲解VBA数组与字典解决方案,今日讲解第80讲内容:利用字典实现单条件,结
阅读全文
摘要:我首先想到的非环版本要做到这一点(循环简单得多),是使用匹配(),但如果你有多个值使用A = Q或同日在那里,你可能会遇到一个问题。 Dim i,j as Integer i=Application.Match(RefCell1,LookUp1,0).Row j=Application.Match(
阅读全文
摘要:本文是讲match函数的踩坑点,大家注意避坑。 1、MATCH函数只在一维数组或者二维一列数组中才有效。如图: A2为二维数组,A3为一维数组, A4为二维一列数组。B运算结果为Error 2042,C运算结果为1,D运算结果为1。 需要注意的是A0是一维数组,A2是二维数组。 如果不借助单元格,要
阅读全文
摘要:Dim rngFound As Range Dim strFirst As String Set rngFound = DataMatchSht.Columns("B").Find("CNH MXI", Cells(Rows.Count, "B"), xlValues, xlWhole) If No
阅读全文
摘要:https://blog.csdn.net/Ares5kong/article/details/126015004
阅读全文
摘要:基础设置:https://jingyan.baidu.com/article/2fb0ba4089721441f3ec5f50.html 关键的地方:1.发送服务器也要设置:控制面板-》用户和账号-》发送服务器
阅读全文
摘要:Sub 文本查询()Range("A1") = VBA.Strings.InStr(Range("A2"), "@")End Sub
阅读全文
摘要:Sub QQ1722187970() Dim sFN As String sFN = Excel.Application.GetOpenFilename() If Len(sFN) Then Dim arrName() Dim objCatalog Set objCatalog = VBA.Crea
阅读全文
摘要:Sub testShape() Dim shp As Shape Dim str As String For Each shp In ActiveSheet.Shapes str = str & shp.Name & vbCrLf Next shp MsgBox "工作表中的3个形状名称依次为:"
阅读全文
摘要:Private Sub TextBox1_AfterUpdate() TextBox1.Text = Format(CDate(TextBox1.Text), "yyyy/m/d") End Sub Private Sub TextBox1_AfterUpdate() On Error GoTo I
阅读全文
摘要:Sub font_sty(Rng As Range) Rng.Select Selection.Font.Bold = True With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeCol
阅读全文
摘要:Sub PDF() Dim asy As Worksheet Dim spath As String spath = Excel.ThisWorkbook.Path For Each asy In Excel.ThisWorkbook.Worksheets sName = spath & "\" &
阅读全文
摘要:1,模块加 Public xOBj As New MSForms.DataObject 2,第一个窗体 Private Sub CommandButton1_Click() If Me.TextBox1.Value = "" Then Exit Sub With xOBj .SetText Me.T
阅读全文
摘要:给用户窗体和控件起一个具有描述性且分类清楚的名字,是一个习惯。最好在每类控件名前加一个前缀来代表该控件的类型,例如,frm代表用户窗体,opt代表选项按钮,等等。这样,将会使代码更易阅读,并且也方便应用一些使代码更为简洁的技巧。 txtFirstName.Text = Range("A1").Val
阅读全文
摘要:在VBA中,虽然没有内置的SortedList数据类型,但可以通过使用Collection对象或自定义类来实现类似的功能。SortedList通常用于按键值对排序和检索数据。以下是一个示例,演示如何使用Collection对象来模拟SortedList的功能: Sub SortedListExamp
阅读全文
摘要:VBA中结构体不能定义在函数或者过程中,要定义在模块中,否则会提示无效内部过程,或者类型未定义 定义: Type Person pName As String pAge As Byte End Type 使用: Dim udtPerson As Person With udtPerson .pNam
阅读全文
摘要:https://blog.csdn.net/sxzlc/article/details/104057637
阅读全文
摘要:定义一个type,这个可以用来传递参数 '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * '* '* 自定义学生对象 '* 做成时间:2020/01/20 '* 做成者: sun '* 跟新日: '* 更新者: '* '* *
阅读全文
摘要:一,用途 让代码可读性更强 调用excel对象的一些事件,如程序级事件,内嵌图表事件,菜单命令事件(后续会学)等 封装API,让代码更简捷易懂(后续会学) 创建控件数组 团队协作时,编写完整模块后可以方便队友调用,减少开发时间 property let 作用:生成对象的可写入属性。 Property
阅读全文
摘要:Private Sub UserForm_Initialize() Dim arr, brr arr = Array("t_Name") brr = Array("张三") For i = 0 To UBound(arr) Debug.Print arr(i) Me.Controls(arr(i))
阅读全文
摘要:'选择文件导入 Private Sub SelectFile_Click() Dim sheet As Excel.Worksheet Dim fieldNameArr(), columnNumArr() Dim sql As String '变量赋值 fieldNameArr = Array("H
阅读全文
摘要:'打开文件返回SheetPublic Function GetSheetByOpenFile() As Worksheet ifilename = Application.GetOpenFilename("Excel(*.xlsx), *.xlsx, Excel(*.xls), *.xls", Fa
阅读全文
摘要:https://copyfuture.com/blogs-details/20200728113553577lwptt8w83gg9qkq
阅读全文
摘要:XiaoFeng组件 C# NET CORE 帮助类库 基础类库、数据库中间件、网络通讯中间件、Redis、Socket、HttpHelper、QueryableX、Cache、FTP、JSON、XML、IO、配置、各种加密码算法、作业调度、正则、通用数据库操作,支持10多种数据库 文档地址: ht
阅读全文
摘要:MsgBox Selection.Row MsgBox Selection.Cells(Selection.Row, 1)
阅读全文
摘要:也许你在使用like语句查询access数据库的时候会发现,like语句查询失败或者报错,为什么会这个样子呢,难道access数据库不支持like语句?答案是否定的,access数据库是绝对支持like语句的,只是你的语句写法有问题罢了,今天我们来详细的说一下like语句在access数据库中的使用
阅读全文
摘要:'反选 Private Sub CommandButton1_Click() Call Testss(Me!TIListBox) End Sub Private Function Testss(ByRef lb As Object) If lb.ListCount < 1 Then MsgBox "
阅读全文
摘要:TIListBox.MultiSelect = 1 TIListBox.ListStyle = 1 TIListBox.ColumnWidths = 62 TIListBox.ColumnCount = 1 Dim arr, brr C_Control arr, brr '将记录集显示到列表框中 D
阅读全文
摘要:Sub addDate1() Dim i As Integer, j As Integer, n As Integer Dim sql As String Dim con As New ADODB.Connection With con .Provider = "microsoft.ace.oled
阅读全文
摘要:Private Sub SearchByTaget() If ConfigSht.Range("A:A").Find(What:="1232", LookAt:=xlWhole) Is Nothing Then MsgBox "不存在" End If End Sub Function SearchB
阅读全文
摘要:Private Sub CommandButton1_Click() '给商品代码下拉列表赋值 Dim tb As ListObject Set tb = Sheet1.ListObjects("表_入库") Dim S01 As Object Set S01 = Sheets("Config")
阅读全文
摘要:VBA从区域range()转化的数组都是二维数组,但特殊的1列或1行可以用Application.transpose为一维数组
阅读全文
摘要:Function getLastRow(ByVal sheetName As Worksheet, ByVal columnName As String) As Long Dim maxRow As Long If Right(rptfile, 3) = "xls" Then maxRow = sh
阅读全文
摘要:Sub 新增行(ByVal tabName As String) On Error Resume Next Set tb = ActiveSheet.ListObjects(tabName) If tb.ListRows.Count > 0 Then tb.ListRows.Add (tb.List
阅读全文