1.
显示活动工作簿名称
MsgBox "
当前活动工作簿是
" & ActiveWorkbook.Name
2.
保存活动工作簿
Activeworkbook.Save
3.
保存所有打开的工作簿关闭
EXCEL
For Each W in Application.Workbooks
W.Save
Next W
Application.Quit
4.
将网格线设置为蓝色
ActiveWindow.GridlineColorIndex = 5
5.
将工作表
sheet1
隐藏
Sheet1.Visible = xlSheetVeryHidden
6.
将工作表
Shtte1
显示
Sheet1.Visible = xlSheetVisible
7.
单击某单元格
,
该单元格所在的行以蓝色背景填充
,
字体颜色为白色
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Row >= 2 Then
’
第二行以下的区域
On Error Resume Next
[ChangColor_With1].FormatConditions.Delete
Target.EntireRow.Name = "ChangColor_With1"
With [ChangColor_With1].FormatConditions
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = 5
.Item(1).Font.ColorIndex = 2
End With
End If
End Sub
8.
使窗体在启动的时候自动最大化
Private Sub UserForm_Initialize()
Application.WindowState = xlMaximized
With Application
Me.Top = .Top
Me.Left = .Left
<