排序工作表 找指定工作表
@@@@@@@@@@
排序工作表
@@@@@@@@@@
Dim bSorted As Boolean
Dim nSortedSheets As Long
Dim nSheets As Long
Dim n As Long
nSheets = Worksheets.Count
nSortedSheets = 0
Do While (nSortedSheets < nSheets) And Not bSorted
bSorted = True
nSortedSheets = nSortedSheets + 1
For n = 1 To nSheets - nSortedSheets
If StrComp(Worksheets(n).Name, Worksheets(n + 1).Name, vbTextCompare) > 0 Then
Worksheets(n + 1).Move Before:=Worksheets(n)
bSorted = False
End If
Next n
Loop
@@@@@@@@@@@@
找指定工作表
@@@@@@@@@@@@
NameXie = InputBox("请输入指定工作表(客户)名字", "inputbox")
NameXie = Trim(NameXie)
num = Sheets.Count
For x = 1 To num
i = InStr(Worksheets(x).Name, NameXie)
' MsgBox (Worksheets(x).Name)
If i <> 0 Then
TempName = Worksheets(x).Name
Worksheets(TempName).Activate
Exit For
End If
Next x
If x > num Then
MsgBox ("sorry!没有找到该客户,请检查输入.^_^~")
End If
num = Sheets.Count
For x = 1 To num
Worksheets(x).Tab.ColorIndex = 1
Next x
ActiveSheet.Tab.ColorIndex = 20


浙公网安备 33010602011771号