|
楼主 |
发表于 2021-8-16 17:31
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
查资料,录宏看代码各种连滚带爬的写了一段。
Public arr
Sub geshihua()
Range("D:M,P:R,X:Z").EntireColumn.Hidden = True
With Range("C1").CurrentRegion 'A1的扩展区域
.Sort Key1:=.Range("C1"), order1:=xlAscending, Header:=xlYes '排序用Range的Sort方法,指定关键字为C1单元格的内容,升序排列,第一行有标题。
End With
Range("A1").AutoFilter Field:=14, Criteria1:=Array("Atlanta, GA", "Los Angeles, CA", "Salt Lake City, UT"), Operator:=xlFilterValues
Columns("C:C").Select
Selection.AutoFit
Columns("A:A").Select
Selection.AutoFit
Columns("s:s").Select
Selection.ColumnWidth = 11.3
Columns("O:O").Select
With Selection.Interior
.Pattern = xlPatternSolid
.ThemeColor = 8
.TintAndShade = 0.8
.PatternColorIndex = -4105
End With
Range("c3").Select
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
arr = Sheet1.Range(Cells(1, 1), Cells(10000, 256))
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Target.Interior.ColorIndex = 35
If Target.Cells.Count = 1 And Target.Value <> arr(Target.Row, Target.Column) Then Target.Interior.ColorIndex = 38
End Sub
|
|