EXCEL高级操作员录制宏的问题解答!急!!!急!!!!

就是先录制一个绝对宏要求设置设置单元格B3:H10的外边框线为细实线内部线为虚线,然后录制一个相对宏要求设置快捷键Ctrl+z将宏保存在当前工作表中设置单元格边框为靛蓝色的双实线底纹为青绿色并用快捷键应用在表2的C3:H10!最后一Web页另存为!

一、绝对引用的宏(给B3:H10加边框)
Sub 边框()
'绝对引用
Range("B3:H10").Select
'外边框线
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous '实线
.Weight = xlThin '细线型
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
End With
'内框线
With Selection.Borders(xlInsideVertical)
.LineStyle = xlDot '虚线
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlDot
.Weight = xlThin
End With
End Sub
二、相对引用的宏(对选中的区域或单元格加边框与底纹)
Sub 边框与底纹()
'对选择区域设置边框与底色
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlDouble '双线型边框
.Weight = xlThick
.ColorIndex = 37 '浅兰色边框
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 37
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 37
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 37
End With
'填充颜色
With Selection.Interior
.ColorIndex = 35 '浅绿色底色
'.Pattern = xlSolid
'.PatternColorIndex = xlAutomatic
End With
End Sub
三、给第二个宏(边框与底纹)设置快捷键为ctrl+z
Sub 设置快捷键()
Application.MacroOptions Macro:="边框与底纹", ShortcutKey:="z"
End Sub

如果要在表2的C3:H10的区域使用第二个宏,请选中这个区域,按ctrl+z即可
与可用下面的宏:
Sub abc()
Sheets("表2").Select
Range("C3:H10").Select
Call 边框与底纹
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-11-26
请描述下问题啊