這樣解決重復的問題,有重復的生成一個:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh As Worksheet
Application.DisplayAlerts = False
For Each sh In Worksheets
If sh.CodeName <> "Sheet1" Then sh.Delete
Next
Application.DisplayAlerts = True
With Sheet1
For c = 1 To .Range("a65536").End(xlUp).Row
If Application.CountIf(.Range("a1:a" & c), .Cells(c, 1)) = 1 Then
Sheets.Add(After:=Sheets(Sheets.Count)).Name = .Cells(c, 1)
End If
Next
.Select
End With
End Sub
如何在工作表中自動填數(shù)
在工作表中能否做成輸入頭尾數(shù),中間就自動填上。
如在D12輸入4,D20輸入12,中間的5-11自動填上;
在I16輸入8,I23輸入15,中間的9-14自動填上。
附件
- Book1.rar (2 KB)
2009-1-3 09:38, 下載次數(shù): 12
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Dim n&, col&, i&
n = Target.Row - 1
col = Target.Column
For i = n To 1 Step -1
If Cells(i, col) <> "" Then
For j = i + 1 To n
Cells(j, col) = Cells(j - 1, col) + 1
Next j
Exit Sub
End If
Next i
End Sub