VBA代码在活动工作表上创建重影图像

时间:2015-03-09 14:07:04

标签: excel vba

当我在电子表格上运行一个宏时,我会在电子表格中找到一个覆盖屏幕一部分的其他表格的叠加层,除去它的唯一方法是滚动或选择另一张表格

我试过的另一个论坛的链接 http://www.excelforum.com/excel-programming-vba-macros/1067951-running-a-certain-macro-results-in-a-ghost-image-of-another-sheet.html#post3995238

代码

Sub Hardware()

Application.ScreenUpdating = False

Dim x As Integer

x = ActiveSheet.UsedRange.Rows.Count

ActiveCell.SpecialCells(xlLastCell).Select

ActiveCell.EntireRow.Cells(1, 1).Offset(1, 0).Activate

Cells(x + 1, 2).Select
ActiveCell.FormulaR1C1 = InputBox("Table ID?")
Cells(x + 1, 3).Select
ActiveCell.FormulaR1C1 = InputBox("Date It Was Purchased?")
Cells(x + 1, 4).Select
ActiveCell.FormulaR1C1 = InputBox("Item Purchased?")
Cells(x + 1, 5).Select
ActiveCell.FormulaR1C1 = InputBox("Which File Tab?")
Cells(x + 1, 6).Select
ActiveCell.FormulaR1C1 = InputBox("Any Notes?")
Cells(x + 1, 7).Select
ActiveCell.FormulaR1C1 = InputBox("Quantity of item?")
Cells(x + 1, 8).Select
ActiveCell.FormulaR1C1 = InputBox("Total Cost?")

ActiveWindow.ScrollColumn = 1

Application.ScreenUpdating = True

End Sub

1 个答案:

答案 0 :(得分:0)

它可能不是“幽灵”图像,而是您在执行VBA宏时使用的另一张图片的实际图像。

Application.ScreenUpdating = False添加到您的代码中,这应该可以修复它。 (一旦你完成更新/计算东西,就把它设置为真)