|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Private Sub CheckBox1_Click()
If Sheet2.CheckBox1.Value = True Then
Call update
End If
End Sub
Private Sub CommandButton1_Click()
Call add
End Sub
Private Sub CommandButton2_Click() '折叠文件夹
Dim total_rows#
total_rows = Sheet3.Cells(1, 4).Value
Application.ScreenUpdating = False
For temrows = 2 To total_rows
If Range("j" & temrows).Interior.ColorIndex = -4142 Then
ActiveSheet.Range("j" & temrows).EntireRow.Hidden = True
End If
Next
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton3_Click() '展开文件夹
展开文件夹
End Sub
Private Function 展开文件夹()
ActiveSheet.usedrange.Select
Selection.EntireRow.Hidden = False
[a1].Select
End Function
Private Sub CommandButton4_Click()
Sheet3.Range(Sheet3.Cells(1, 2), Sheet3.Cells(Sheet3.Range("B65536").End(xlUp).Row, 2)).clear
Call clear
End Sub
Private Sub CommandButton5_Click() '更新目录
Dim p#, TEMP#
Call clear
i = 2
tmp_rows = 2
TEMP = Sheet3.Range("b65536").End(xlUp).Row
For p = 1 To TEMP
'tmp_rows = Sheet3.Range("D1").Value
spath = Sheet3.Cells(p, 2)
spath_tmp = spath
If spath = "" Then Exit Sub
Call 展开文件夹
Call 获得当前文件夹名
spath = spath & "\"
Call 获取当前文件名
Call getfolder(spath)
Sheet3.Range("D1") = i
Next
Call 设置目录线
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
End Sub
'Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'End Sub
Sub tt()
MsgBox Range("b:b").End(xlUp).Row
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column < 11 Then
Cancel = True
On Error Resume Next '如出错,则从出错行下一行开始执行
Dim Myra As Range
Dim Myur As Integer, Tem1 As Integer, Temr As Integer, Temc As Integer
Myur = Sheet3.Cells(1, 4).Value '获得使用单元格的行数
If Target.Row <= 1 Then Exit Sub '选定单元格的行号<=3时退出
If Target.Interior.ColorIndex <> -4142 Then '选定单元格内填充颜色为3_兰
Set Myra = Target.Cells(1, 1).MergeArea.Cells(1, Target.Count) '返回选定合并单元内最右边的单元格
If Myra.MergeCells Then '判断其是否为合并单元格
Temr = Myra.Row '获得行号
Temc = Myra.Column '获得列号
For Tem1 = Temr + 1 To Myur
If Cells(Tem1, Temc).MergeCells Then '判断其是否为合并单元格
If Tem1 - 1 < Temr + 1 Then Exit Sub
Range(Cells(Temr + 1, Temc), Cells(Tem1 - 1, Temc)).EntireRow.Hidden = _
Not Range(Cells(Temr + 1, Temc), Cells(Tem1 - 1, Temc)).EntireRow.Hidden
'隐藏或显示行
Exit Sub
End If
Next
Range(Cells(Temr + 1, Temc), Cells(Myur, Temc)).EntireRow.Hidden = _
Not Range(Cells(Temr + 1, Temc), Cells(Myur, Temc)).EntireRow.Hidden
'隐藏或显示行
End If
End If
End If
End Sub
|
|