关于excel一段代码 无法运行,请教高人

来源:百度知道 编辑:UC知道 时间:2024/06/09 11:14:19
下面这段代码,下面网址中4楼的那一片代码,需要删除点东西才能运行出来,请高人指教。截图 我只截了 一部分。没有病毒 大家放心

http://club.excelhome.net/thread-82068-1-1.html

Paste the following two macro(rulers in CM & Inch), then press Alt+F8 to initiate one of them. I don't think it's a useful ruler, just for fun:

要把上面这一段删除
然后,,其它的改成以下形式,例如

Dim i As Long
Dim l As Long
Dim x As Long
Dim y As Long
Dim ws As Worksheet
Dim x2 As Double
Dim y2 As Double
x = Ruler_Width * 10
y = Ruler_Height * 10

Application.ScreenUpdating = False

Set ws = ActiveSheet
Worksheets.Add ActiveSheet.Move
ActiveSheet.Lines.Add 0, 0, 3 * x, 0
For i = 1 To x
If i Mod 10 = 0 Then l = 5 Else: If i Mod 5 = 0 Then l = 4 Else: l = 3
ActiveSheet.Lines.Add 3 * i, 0, 3 * i, 3 * l
Next

看得头晕,,,你慢慢改吧。