|
本帖最后由 sogo777 于 2014-4-25 18:18 编辑
- Sub 罗列()
- ActiveSheet.Protect Password:="1", userInterFaceonly:=True
- ThisWorkbook.Sheets("星期一").Range("B:B").ClearContents
- ThisWorkbook.Sheets("1").Range("c2:c65535").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=ThisWorkbook.Sheets("星期一").Range( _
- "b2"), Unique:=True
- ThisWorkbook.Sheets("星期二").Range("B:B").ClearContents
- ThisWorkbook.Sheets("2").Range("c2:c65535").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=ThisWorkbook.Sheets("星期二").Range( _
- "b2"), Unique:=True
- ThisWorkbook.Sheets("星期三").Range("B:B").ClearContents
- ThisWorkbook.Sheets("3").Range("c2:c65535").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=ThisWorkbook.Sheets("星期三").Range( _
- "b2"), Unique:=True
- ThisWorkbook.Sheets("星期四").Range("B:B").ClearContents
- ThisWorkbook.Sheets("4").Range("c2:c65535").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=ThisWorkbook.Sheets("星期四").Range( _
- "b2"), Unique:=True
- ThisWorkbook.Sheets("星期五").Range("B:B").ClearContents
- ThisWorkbook.Sheets("5").Range("c2:c65535").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=ThisWorkbook.Sheets("星期五").Range( _
- "b2"), Unique:=True
- ThisWorkbook.Sheets("星期六").Range("B:B").ClearContents
- ThisWorkbook.Sheets("6").Range("c2:c65535").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=ThisWorkbook.Sheets("星期六").Range( _
- "b2"), Unique:=True
- ThisWorkbook.Sheets("星期日").Range("B:B").ClearContents
- ThisWorkbook.Sheets("7").Range("c2:c65535").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=ThisWorkbook.Sheets("星期日").Range( _
- "b2"), Unique:=True
- End Sub
复制代码 各位老师,帮忙看下,我这个宏如果不启用工作表保护就可以顺利运行,如果启用了工作表保护,加上了第一句代码ActiveSheet.Protect Password:="1", userInterFaceonly:=True 这样应该可以操作锁定的工作表
可是为什么还是400错误呢?
|
|