|
本帖最后由 LMY123 于 2018-4-16 16:40 编辑
ExcelVBA与数据库整合应用范例精讲
http://club.excelhome.net/thread-454353-1-1.html
《excel vba整合数据库应用从基础到实践》
http://club.excelhome.net/forum.php?mod=viewthread&tid=1265971&extra=&ordertype=1&page=2字段不完全相同的多个工作簿按工作表名汇总
http://club.excelhome.net/thread-811719-3-1.htmlheet1.UsedRange.Address
Sub A()
arr = Sheet1.UsedRange
Cells(1, 2) = Sheet1.UsedRange.Address '位置
Cells(2, 2) = Sheet1.UsedRange.Rows.Count '行数
Cells(3, 2) = Sheet1.UsedRange.Columns.Count '列数
Cells(4, 2) = UBound(arr) '行数
Cells(5, 2) = UBound(arr, 2) '列数
Cells(6, 2) = Split(Sheet1.UsedRange.Address, ":")(0) '起始单元格
Cells(7, 2) = Split(Sheet1.UsedRange.Address, ":")(1) '终止单元格
Cells(8, 2) = Split(Split(Sheet1.UsedRange.Address, ":")(0), "$")(2) '起始行数
Cells(9, 2) = Split(Split(Sheet1.UsedRange.Address, ":")(1), "$")(2) '终止行数
Cells(10, 2) = Split(Split(Sheet1.UsedRange.Address, ":")(0), "$")(1) '起始列
Cells(11, 2) = Split(Split(Sheet1.UsedRange.Address, ":")(1), "$")(1) '终止列
'Cells(12, 2) = Left(ActiveSheet.Cells(1, 1).Address(0, 0), IIf(1 > 26, 2, 1)) '起始列
Cells(13, 2) = Asc(Split(Split(Sheet1.UsedRange.Address, ":")(0), "$")(1)) - 64 '起始列用数字表示
Cells(14, 2) = Asc(Split(Split(Sheet1.UsedRange.Address, ":")(1), "$")(1)) - 64 '终止列用数字表示
End Sub
Sub B()
arr = Sheet2.UsedRange
Cells(1, 3) = Sheet2.UsedRange.Address
Cells(2, 3) = Sheet2.UsedRange.Rows.Count
Cells(3, 3) = Sheet2.UsedRange.Columns.Count
Cells(4, 3) = UBound(arr)
Cells(5, 3) = UBound(arr, 2)
Cells(6, 3) = Split(Sheet2.UsedRange.Address, ":")(0)
Cells(7, 3) = Split(Sheet2.UsedRange.Address, ":")(1)
Cells(8, 3) = Split(Split(Sheet2.UsedRange.Address, ":")(0), "$")(2)
Cells(9, 3) = Split(Split(Sheet2.UsedRange.Address, ":")(1), "$")(2)
Cells(10, 3) = Split(Split(Sheet2.UsedRange.Address, ":")(0), "$")(1)
Cells(11, 3) = Split(Split(Sheet2.UsedRange.Address, ":")(1), "$")(1)
'Cells(12, 3) = Left(ActiveSheet.Cells(1, 1).Address(0, 0), IIf(1 > 26, 2, 1)) '起始列
Cells(13, 3) = Asc(Split(Split(Sheet2.UsedRange.Address, ":")(0), "$")(1)) - 64 '起始列用数字表示
Cells(14, 3) = Asc(Split(Split(Sheet2.UsedRange.Address, ":")(1), "$")(1)) - 64 '终止列用数字表示
End Sub
'=CODE("B")值为66
'=char(66)值为B
补充内容 (2018-10-19 08:17):
http://club.excelhome.net/forum. ... rid=9051&page=6
补充内容 (2018-10-19 08:24):
同名文件移动到文件夹中,批处理
http://club.excelhome.net/thread-1101060-3-1.html
补充内容 (2018-10-19 08:30):
http://club.excelhome.net/thread-1046956-1-1.html
补充内容 (2018-10-19 08:38):
http://club.excelhome.net/thread-1341482-1-1.html
补充内容 (2018-10-19 09:34):
子文件夹
http://club.excelhome.net/thread-1313813-2-1.html
补充内容 (2018-10-19 09:35):
Set fso = CreateObject("scripting.filesystemobject")
Set ff = fso.getfolder(ThisWorkbook.Path)
For Each Fd In ff.subfolders
For Each f In ff.Files
补充内容 (2018-10-19 09:39):
http://club.excelhome.net/forum. ... =1322027&page=1
补充内容 (2018-10-19 09:39):
arr(1) = ThisWorkbook.Path & "\"
i = 1: k = 1
Do While i < UBound(arr)
If arr(i) = "" Then Exit Do
f = Dir(arr(i), vbDirectory)
Do While f <> ""
If InStr(f, ".") = 0 Then
k = k + 1
arr(k) = arr(i) & f & "\"
End If
f = Dir
Loop
i = i + 1
Loop
补充内容 (2018-10-19 09:42):
http://club.excelhome.net/thread-1176868-1-1.html
补充内容 (2018-10-19 09:43):
Sub GetFiles(ByVal Folder As Object, arr$(), m&)
Dim SubFolder As Object
Dim File As Object
If Folder.Path <> ThisWorkbook.Path Then
For Each File In Folder.Files
If File.Name Like "*.xls" Then
m = m + 1
ReDim Preserve arr(1 To 2, 1 To m)
arr(1, m) = File
arr(2, m) = File.Name
End If
Next
End If
For Each SubFolder In Folder.SubFolders
Call GetFiles(SubFolder, arr, m)
Next
End Sub
补充内容 (2018-10-19 09:47):
http://club.excelhome.net/thread-1291376-1-1.html
补充内容 (2018-10-19 09:47):
mypath = ThisWorkbook.Path & "\供应商导入\"
myfile = Dir(mypath, vbDirectory)
Do While myfile <> ""
If myfile <> "." And myfile <> ".." Then
If (GetAttr(mypath & myfile) And vbDirectory) = vbDirectory Then
m = m + 1
ReDim Preserve arr(m)
arr(m) = mypath & myfile & "\"
End If
End If
myfile = Dir
Loop
补充内容 (2018-10-23 17:39):
Do While cDir <> ""
If Not cDir Like ".*" Then
If GetAttr(cPath & cDir) = 16 Then
s = s + 1
Arr(s) = cDir
End If
End If
...http://club.excelhome.net/thread-1279161-1-1.html
补充内容 (2018-11-23 10:04):
E TO A
http://club.excelhome.net/thread-1002096-1-1.html
补充内容 (2018-11-23 11:43):
《Excel 2010 VBA实战技巧精粹》示例文件免费下载
http://club.excelhome.net/thread-1225901-1-1.html
补充内容 (2018-11-23 15:10):
在EXCEL中操作ACCESS库
http://club.excelhome.net/forum. ... rid=9051&page=6 |
评分
-
5
查看全部评分
-
|