我希望你能提前帮助和感谢。我有以下代码,我想添加冻结/锁定单元格$H$3
的代码。请帮忙。
Sub Copy_Tabs_New()
Dim x, ListItem As Variant
Dim numtimes As Byte
x = InputBox("Enter number of times to copy 4075 Wilson")
If Not IsNumeric(x) Then Exit Sub
If (x < 1) Or (x > 55) Then Exit Sub
ActiveWorkbook.Sheets("4075 Wilson").Select
ListItem = Range("C3").Value
Application.ScreenUpdating = False
For numtimes = 1 To x
ActiveWorkbook.Sheets("4075 Wilson").Copy After:=ActiveSheet
Range("H3").Value = ListItem
Range("C3").Value = Range("B2").Value
ListItem = Range("C3").Value
Next
ActiveWorkbook.Sheets("4075 Wilson").Select
Application.ScreenUpdating = True
End Sub
答案 0 :(得分:0)
怎么样:
Sub Copy_Tabs_New()
Dim x, ListItem As Variant
Dim numtimes As Byte
x = InputBox("Enter number of times to copy 4075 Wilson")
If Not IsNumeric(x) Then Exit Sub
If (x < 1) Or (x > 55) Then Exit Sub
ActiveWorkbook.Sheets("4075 Wilson").Select
ListItem = Range("C3").Value
Application.ScreenUpdating = False
For numtimes = 1 To x
ActiveWorkbook.Sheets("4075 Wilson").Copy After:=ActiveSheet
Range("H3").Value = ListItem
Call freeeze
Range("C3").Value = Range("B2").Value
ListItem = Range("C3").Value
Next
ActiveWorkbook.Sheets("4075 Wilson").Select
Application.ScreenUpdating = True
End Sub
Sub freeeze()
With ActiveSheet
.Unprotect
.Cells.Locked = False
.Range("H3").Locked = True
.Protect
End With
End Sub