Office中国论坛/Access中国论坛
标题:
请教如何在这段代码中设定公式?
[打印本页]
作者:
zerk
时间:
2006-11-14 04:18
标题:
请教如何在这段代码中设定公式?
我想在代码中用公式写所有工作表的 hyperlink,但是 hyperlink 一句总是出错,请高手指点一下。
Dim S_Name, S_Formula As String, Y As Integer
Y = 1
For i = 1 To Worksheets.Count
S_Name = Worksheets(i).Name
If S_Name <> "目录" Then
Worksheets("目录").Range("b" & 2 + Y).Value = S_Name
S_Formula = "=HYPERLINK('#' & b" & 2 + Y & " & '!a1','点击选择[' & B" & 2 + Y & " & ']')"
'就是这句,formula总是不对,请指教!
'MsgBox S_Formula
Worksheets("目录").Range("c" & 2 + Y).Formula = S_Formula
Y = Y + 1
End If
Next i
作者:
老鬼
时间:
2006-11-15 06:23
S_Formula = "=HYPERLINK(""#" & Range("b" & 2 + Y) & "!a1"",""点击选择[" & Range("b" & 2 + Y) & "]"")"
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3