|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
原帖由 1604930 于 2010-11-23 22:34 发表
我晕,我用的是你的代码啊,
可是,我用其他公式,你的代码就不管用了啊。。。你看看附件 黄色部分
对不起,这个需要定制!- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim MyStrA$, MyStrB$, MyStrC$, Rng As Range
- If Target.Count <> 1 Then Exit Sub
- On Error Resume Next
- MyStrA = Target.Formula
- MyStrB = Mid(MyStrA, InStr(1, MyStrA, "!") - 5, 5)
- MyStrC = Mid(MyStrA, InStr(1, MyStrA, "!") + 1, 2)
- Target.NumberFormatLocal = Sheets(MyStrB).Range(MyStrC).NumberFormatLocal
- End Sub
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- Dim MyStrA$, MyStrB$, MyStrC$, Rng As Range
- On Error Resume Next
- For Each Rng In Selection
- MyStrA = Rng.Formula
- MyStrB = Mid(MyStrA, InStr(1, MyStrA, "!") - 5, 5)
- MyStrC = Mid(MyStrA, InStr(1, MyStrA, "!") + 1, 2)
- Rng.NumberFormatLocal = Sheets(MyStrB).Range(MyStrC).NumberFormatLocal
- Next
- End Sub
复制代码 |
|