|
请教高人如何添加一个新的指令,万分感谢啊
Sub jia()
'上Ctrl+j
Dim jia, jc, jr, x%, y%
Dim jia1, jc1, jr1
Dim jia2, jc2, jr2
Dim rng As Range, cel As Range
Dim rng1 As Range, cel1 As Range
Set rng = Range("b3:c500")
For Each cel In rng
If cel = "" Then jia = cel.Address: jc = cel.Column: jr = cel.Row: Exit For
Next cel
Set rng1 = Range("m3:o500")
For Each cel1 In rng1
If cel1 = "" Then jia1 = cel1.Address: jc1 = cel1.Column: jr1 = cel1.Row: Exit For
Next cel1
100:
Range(jia) = [e1]
With Range(jia).Font
.FontStyle = "加粗"
.ColorIndex = 2
End With
Range(jia).Interior.ColorIndex = 3
Range(jia1) = [e1]
With Range(jia1).Font
.FontStyle = "加粗"
.ColorIndex = 2
End With
Range(jia1).Interior.ColorIndex = 3
End Sub
Sub jian()
'下Ctrl+m
Dim jia, jc, jr, x%, y%
Dim jia1, jc1, jr1
Dim jia2, jc2, jr2
Dim rng As Range, cel As Range
Dim rng1 As Range, cel1 As Range
Set rng = Range("b3:c500")
For Each cel In rng
If cel = "" Then jia = cel.Address: jc = cel.Column: jr = cel.Row: Exit For
Next cel
Set rng1 = Range("m3:o500")
For Each cel1 In rng1
If cel1 = "" Then jia1 = cel1.Address: jc1 = cel1.Column: jr1 = cel1.Row: Exit For
Next cel1
100:
Range(jia) = [g1]
With Range(jia).Font
.FontStyle = "加粗"
.ColorIndex = 2
End With
Range(jia).Interior.ColorIndex = 5
Range(jia1) = [g1]
With Range(jia1).Font
.FontStyle = "加粗"
.ColorIndex = 2
End With
Range(jia1).Interior.ColorIndex = 5
End Sub
上面这段代码能够按照指令实现:ctrl键+J在B3--C500显示“上”,ctrl键+m在B3--C500显示“下”。现在我想加个ctrl键+n在B3--C500显示“中”请高手帮忙看看,给改下。多谢。 |
|