週一,05 2022月
  2 回复
  5.5K訪問
-1
投票
復原
嗨,我是 Macros、VBA 和 Kutools 的新手。

我正在運行一個宏來提取文本,然後在單獨的單元格中提取數字。 Kutools 在我運行時工作正常,但是當我按照相同的過程創建宏時,我收到一條錯誤消息:

Windows("KutoolsHelper.xlam").Visible = True

這似乎是調試中發生錯誤的地方。

我在工具/參考中添加了 Kutoolsforexcel


子 ConvetYardsToMiles()
'
'ConvetYardsToMiles 宏
'

'
列(“我:我”)。選擇
Selection.Copy
選擇.插入 Shift:=xlToRight
Application.CutCopyMode = False
Selection.Copy
選擇.插入 Shift:=xlToRight
列(“J:J”)。選擇
Windows("KutoolsHelper.xlam").Visible = True
ActiveWindow.Visible = 假
列(“K:K”)。選擇
Windows("KutoolsHelper.xlam").Visible = True
ActiveWindow.Visible = 假
ActiveWindow.SmallScroll ToRight:=1
範圍(“L2”)。選擇
ActiveCell.FormulaR1C1 = "=IF(RC[-2]=""mi"",RC[-1],RC[-1]/1760)"
範圍(“L2”)。選擇
選擇.自動填充目標:=範圍(“L2:L832”)
範圍(“L2:L832”)。選擇
列(“L:L”)。選擇
Selection.NumberFormat = "0.00 英里"
列(“L:L”)。選擇
列(“L:L”).EntireColumn.AutoFit
選擇.ColumnWidth = 14.91
範圍(“L1”)。選擇
ActiveCell.FormulaR1C1 = "行駛里程"
範圍(“L2”)。選擇
ActiveWindow.SmallScroll ToRight:=-1
列(“H:K”)。選擇
選擇.EntireColumn.Hidden = True
ActiveWindow.SmallScroll ToRight:=-4
列(“L:L”)。選擇
有選擇
.Horizo​​ntalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.方向 = 0
.AddIndent = 假
.縮進級別 = 0
.ShrinkToFit = 假
.ReadingOrder = xlContext
.MergeCells = 假
結束
有選擇
.Horizo​​ntalAlignment = xlCenter
.VerticalAlignment = xlCenter
.方向 = 0
.AddIndent = 假
.縮進級別 = 0
.ShrinkToFit = 假
.ReadingOrder = xlContext
.MergeCells = 假
結束
行(“1:1”)。選擇
範圍(“C1”)。激活
選擇.Font.Bold = False
選擇.Font.Bold = True
使用 Selection.Font
.Name = "宋體"
.刪除線=假
.上標=假
.下標=假
.OutlineFont = 假
.Shadow = 假
.下劃線 = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
結束
使用 Selection.Font
.Name = "宋體"
大小= 12
.刪除線=假
.上標=假
.下標=假
.OutlineFont = 假
.Shadow = 假
.下劃線 = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
結束
有選擇
.Horizo​​ntalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = 假
.方向 = 0
.AddIndent = 假
.縮進級別 = 0
.ShrinkToFit = 假
.ReadingOrder = xlContext
.MergeCells = 假
結束
END SUB
我對這行代碼有同樣的問題:

Windows("KutoolsHelper.xlam").Visible = True

是否允許從另一個錄製的宏調用 Kutools 宏?
  • 頁:
  • 1
有沒有為這個職位尚未作出回复。