0

我编写了一个在打开文件时运行的宏,并以 range("a1").select 结束宏。问题是无论我用什么结束宏,即。滚动,选择,激活,当文件打开并且宏运行完成时,选定的单元格为 A8。A8 直接在一行下方,单元格跨多列合并,我不确定这是否是原因。请帮忙!

代码:

Sub Macro1()

'
    Rows("6:6").Select
    Selection.Insert Shift:=xlDown
    Range("B7:O8").Select
    Selection.ClearContents
    Range("B6:H8").Select

    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With

    Range("B6:H6").Select
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With

    Range("B7:B8,E7:E8").Select
        With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    Range("C7:C8,F7:F8").Select

    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With

    Range("D7:E7,G7:H7").Select


    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With

    Range("B6").Select
    With Selection.Font
        .Size = 14
    End With
    ActiveCell.FormulaR1C1 = "Current Period"
    Range("B6:H6").Select
    With Selection
        .HorizontalAlignment = xlCenterAcrossSelection
           End With
    Range("B8").Select
    ActiveCell.FormulaR1C1 = "Actual"
    Range("B8").Select
    With Selection
        .HorizontalAlignment = xlCenter

    End With
    With Selection.Font
        .Name = "Helvetica"
        .Size = 12
    End With
    Range("C8").Select
    With Selection.Font
        .Name = "Helvetica"
        .Size = 12
    End With
    With Selection
        .HorizontalAlignment = xlCenter

    End With
    ActiveCell.FormulaR1C1 = "Budget"
    Rows("8:8").Select
    With Selection
        .HorizontalAlignment = xlCenter

    End With
    Range("D8").Select
    ActiveCell.FormulaR1C1 = "$"
    Range("E8").Select
    ActiveCell.FormulaR1C1 = "%"
    Range("D7:E8").Select
    Range("D8").Activate
    With Selection.Font
        .Name = "Helvetica"
        .Size = 10
    End With
    Range("F8").Select
    With Selection.Font
        .Name = "Helvetica"
        .Size = 12
    End With
    ActiveCell.FormulaR1C1 = "Last Year"
    Range("G7:H8").Select
    Range("G8").Activate
    ActiveCell.FormulaR1C1 = "$"
    With Selection.Font
        .Name = "Helvetica"
        .Size = 10
    End With

    Range("H8").Select
    ActiveCell.FormulaR1C1 = "%"
    Range("D7").Select
    ActiveCell.FormulaR1C1 = "B/(W) Than Budget"
    Range("D7:E7").Select
    With Selection
        .HorizontalAlignment = xlCenterAcrossSelection

    End With
    Range("G7:H7").Select
    With Selection
        .HorizontalAlignment = xlCenterAcrossSelection

    End With
    ActiveCell.FormulaR1C1 = "B/(W) Than Last Year"
    Range("B6:H8").Select
    Selection.Copy
    Range("I6").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Range("I6").Select
    ActiveCell.FormulaR1C1 = "Year To Date"
    Rows("1:4").Select
    With Selection.Font
        .Size = 14
    End With
    Rows("9:138").Select
    With Selection.Font
        .Size = 10
    End With
    Rows("125:125").Select
    Selection.ClearContents
    Rows("133:133").Select
    Selection.ClearContents
    Range("B:D,F:G,I:K,M1,M:N").Select
    Range("M1").Activate
    Selection.ColumnWidth = 15
    Range("E:E,h:h,l:l,o:o").Select
    Selection.ColumnWidth = 12
    Range("A:A").Select
    Selection.ColumnWidth = 40
    With ActiveSheet.PageSetup
        .PrintTitleRows = "$1:$8"
    End With


Rows("6:6").Select
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown


Columns("i:i").Select
Selection.Insert Shift:=xlRight

Range("g14:i14").Select
With Selection
.HorizontalAlignment = xlLeft
End With

Range("g14:h14").Select
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
End With
Range("b13:i13").Select
With Selection
.HorizontalAlignment = xlLeft
End With

Range("b13:h13").Select
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
End With

Range("k16:k200").Select
Selection.Copy
Range("i16:i200").Select
Selection.PasteSpecial Paste:=xlPasteFormats

Range("i:i,q:q").Select
Selection.ColumnWidth = 38
With Selection
.WrapText = True
End With

Range("i13").Select
Selection.Borders(xlEdgeTop).LineStyle = xlNone
    Selection.Borders(xlEdgeBottom).LineStyle = xlNone


Range("i16").Select
With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlHairline
        .ColorIndex = xlAutomatic
    End With
Range("i17").Select
With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlHairline
        .ColorIndex = xlAutomatic
    End With

Selection.Copy
Range("i17:i200,q16:q200").Select
ActiveSheet.Paste

Range("i14").Select
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
ActiveCell.FormulaR1C1 = "Describe Variance"
With Selection
.HorizontalAlignment = xlCenter
End With
Selection.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "to CP Budget"
With Selection
.HorizontalAlignment = xlCenter
End With
Range("i14:i15").Select
Selection.Copy
Range("q14:q15").Select
Selection.PasteSpecial Paste:=xlPasteFormats

Range("q14").Select
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
ActiveCell.FormulaR1C1 = "Describe Variance"
With Selection
.HorizontalAlignment = xlCenter
End With
Selection.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "to YTD Budget"
With Selection
.HorizontalAlignment = xlCenter
End With


Cells.Find("ebitda", lookat:=xlWhole).Select
Selection.Offset(2, 0).Select
Range(ActiveCell, ActiveCell.Offset(200, 0)).Select
Selection.EntireRow.Delete

Cells.Find("ebitda", lookat:=xlWhole).Select
Selection.Offset(3, 0).Select
ActiveCell = "Explanation of EBITDA Variance to Budget (Only required if variance exceeded the acceptable range for your group)"
Range(ActiveCell, ActiveCell.Offset(0, 16)).Select
With Selection.Font
        .Size = 14
        .Bold = True
    End With
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
End With
Selection.Offset(1, 0).Select
Range(ActiveCell, ActiveCell.Offset(0, 16)).Select
Selection.Merge
Selection.RowHeight = 50
With Selection.Font
        .Size = 10
         .Bold = True
    End With


    With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
End With
 With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With

Range("a1:q11").Select
With Selection
.HorizontalAlignment = xlLeft
End With

With Selection
.HorizontalAlignment = xlCenterAcrossSelection
End With


Range("a6").Select
ActiveCell = "Publisher's Summary"
With Selection.Font
        .Size = 14
    End With
Range("a9").Select
ActiveCell = "Market Outlook"
With Selection.Font
        .Size = 14
    End With



Rows("10:10").Select
Selection.RowHeight = 70
Range("a10:q10").Select
Selection.Merge
 With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
        With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
End With

    With ActiveSheet.PageSetup
        .RightHeader = "&9Page &P of &N"
        .LeftMargin = Application.InchesToPoints(0.25)
        .RightMargin = Application.InchesToPoints(0.25)
        .TopMargin = Application.InchesToPoints(0.25)
        .BottomMargin = Application.InchesToPoints(0.25)
        .HeaderMargin = Application.InchesToPoints(0.1)
        .FooterMargin = Application.InchesToPoints(0.15)
        .CenterHorizontally = True
        .Orientation = xlLandscape
        .FitToPagesWide = 1
          .FitToPagesTall = 2
        .Zoom = False
    End With


    ActiveWindow.Zoom = 70


Rows("7:7").Select
Selection.RowHeight = 180
Range("a7:q7").Select
Selection.Merge
 With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
End With

'

Cells.Select

With Selection

.Locked = False
End With

Cells.Find("ebitda", lookat:=xlWhole).Select
Selection.Offset(1, 1).Select

Range(ActiveCell, "h13").Select

With Selection

.Locked = True
End With

Cells.Find("ebitda", lookat:=xlWhole).Select
Selection.Offset(1, 9).Select

Range(ActiveCell, "p13").Select

With Selection

.Locked = True
End With




Range("a1").Select


ActiveSheet.Protect userinterfaceonly:=True


ActiveWindow.FreezePanes = False

End Sub
4

3 回答 3

1
Range("a1").Select

ActiveSheet.Protect userinterfaceonly:=True

我怀疑 A1 是一个锁定的单元格,因此当您保护工作表时,它会跳转到最近的未锁定的可用单元格(假设上次使用时未选中允许选择锁定单元格的选项)。

于 2013-07-31T14:46:43.130 回答
0

您应该首先摆脱所有 .select 语句(或尽可能多地)。我知道这不是一个明确的答案,但要发表评论是很重要的。我相信在你的代码中去掉 .Select 会解决这个问题……但要解决这个问题还需要一些工作。尽管如此,这是一个开始:

Option Explicit

Sub Macro1()

Application.ScreenUpdating = False
'
    Rows("6:6").Insert Shift:=xlDown
    Range("B7:O8").ClearContents

    With Range("B6:H8").Borders
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Range("B6:H6").Borders
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With

    With Range("B7:B8,E7:E8").Borders
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With


    With Range("C7:C8,F7:F8").Borders
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With

    With Range("D7:E7,G7:H7").Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With

    With Range("B6").Font
        .Size = 14
    End With
    Range("B6").FormulaR1C1 = "Current Period"
    Range("B6:H6").HorizontalAlignment = xlCenterAcrossSelection

    Range("B8").FormulaR1C1 = "Actual"
    Range("B8").HorizontalAlignment = xlCenter


    With Range("B8").Font
        .Name = "Helvetica"
        .Size = 12
    End With

    With Range("C8").Font
        .Name = "Helvetica"
        .Size = 12
    End With

    Range("C8").HorizontalAlignment = xlCenter

    ActiveCell.FormulaR1C1 = "Budget"
    Rows("8:8").Select
    With Selection
        .HorizontalAlignment = xlCenter

    End With
    Range("D8").FormulaR1C1 = "$"
    Range("E8").FormulaR1C1 = "%"

    With Range("D7:E8").Font
        .Name = "Helvetica"
        .Size = 10
    End With

    With Range("F8").Font
        .Name = "Helvetica"
        .Size = 12
    End With

    Range("F8").FormulaR1C1 = "Last Year"
        Range("G8").FormulaR1C1 = "$"
    With Range("G7:H8").Font
        .Name = "Helvetica"
        .Size = 10
    End With

    Range("H8").FormulaR1C1 = "%"
    Range("D7").FormulaR1C1 = "B/(W) Than Budget"
    Range("D7:E7").HorizontalAlignment = xlCenterAcrossSelection


    Range("G7:H7").HorizontalAlignment = xlCenterAcrossSelection

    Range("G7").FormulaR1C1 = "B/(W) Than Last Year"
    Range("B6:H8").Copy Range("I6")
    Range("I6").FormulaR1C1 = "Year To Date"
    With Rows("1:4").Font
        .Size = 14
    End With

    With Rows("9:138").Font
        .Size = 10
    End With

    Rows("125:125").ClearContents
    Rows("133:133").ClearContents
    Range("B:D,F:G,I:K,M1,M:N").ColumnWidth = 15
    Range("E:E,h:h,l:l,o:o").ColumnWidth = 12
    Range("A:A").ColumnWidth = 40
    With ActiveSheet.PageSetup
        .PrintTitleRows = "$1:$8"
    End With


Rows("6:12").Insert Shift:=xlDown

Columns("i:i").Insert Shift:=xlRight

Range("g14:i14").HorizontalAlignment = xlLeft


Range("g14:h14").HorizontalAlignment = xlCenterAcrossSelection

Range("b13:i13").HorizontalAlignment = xlLeft

Range("b13:h13").HorizontalAlignment = xlCenterAcrossSelection


Range("k16:k200").Copy
Range("i16:i200").PasteSpecial Paste:=xlPasteFormats

Range("i:i,q:q").ColumnWidth = 38
Range("i:i,q:q").WrapText = True



Range("i13").Borders(xlEdgeTop).LineStyle = xlNone
Range("i13").Borders(xlEdgeBottom).LineStyle = xlNone


With Range("i16").Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlHairline
        .ColorIndex = xlAutomatic
    End With

With Range("i17").Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlHairline
        .ColorIndex = xlAutomatic
    End With

Range("i17").Copy Range("i17:i200", "q16:q200")
    With Range("i14").Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With

Range("i14").FormulaR1C1 = "Describe Variance"

Range("i14").HorizontalAlignment = xlCenter

Range("i14").Offset(1, 0).FormulaR1C1 = "to CP Budget"

Range("i14").Offset(1, 0).HorizontalAlignment = xlCenter

Range("i14:i15").Copy
Range("q14:q15").PasteSpecial Paste:=xlPasteFormats


With Range("q14").Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
End With
Range("q14").FormulaR1C1 = "Describe Variance"
Range("q14").HorizontalAlignment = xlCenter

Range("q14").Offset(1, 0).FormulaR1C1 = "to YTD Budget"

Range("q14").Offset(1, 0).HorizontalAlignment = xlCenter



'''''''''''
'  Stopped here
'''''''''''


Cells.Find("ebitda", lookat:=xlWhole).Select
Selection.Offset(2, 0).Select
Range(ActiveCell, ActiveCell.Offset(200, 0)).Select
Selection.EntireRow.Delete

Cells.Find("ebitda", lookat:=xlWhole).Select
Selection.Offset(3, 0).Select
ActiveCell = "Explanation of EBITDA Variance to Budget (Only required if variance exceeded the acceptable range for your group)"
Range(ActiveCell, ActiveCell.Offset(0, 16)).Select

With Selection.Font
        .Size = 14
        .Bold = True
    End With
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
End With

Selection.Offset(1, 0).Select
Range(ActiveCell, ActiveCell.Offset(0, 16)).Select
Selection.Merge
Selection.RowHeight = 50
With Selection.Font
        .Size = 10
         .Bold = True
End With


    With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
End With

 With Selection.Borders
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
 End With

Range("a1:q11").Select
With Selection
.HorizontalAlignment = xlLeft
End With

With Selection
.HorizontalAlignment = xlCenterAcrossSelection
End With


Range("a6").Select
ActiveCell = "Publisher's Summary"
With Selection.Font
        .Size = 14
    End With
Range("a9").Select
ActiveCell = "Market Outlook"
With Selection.Font
        .Size = 14
    End With



Rows("10:10").Select
Selection.RowHeight = 70
Range("a10:q10").Select
Selection.Merge
 With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
        With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
End With

    With ActiveSheet.PageSetup
        .RightHeader = "&9Page &P of &N"
        .LeftMargin = Application.InchesToPoints(0.25)
        .RightMargin = Application.InchesToPoints(0.25)
        .TopMargin = Application.InchesToPoints(0.25)
        .BottomMargin = Application.InchesToPoints(0.25)
        .HeaderMargin = Application.InchesToPoints(0.1)
        .FooterMargin = Application.InchesToPoints(0.15)
        .CenterHorizontally = True
        .Orientation = xlLandscape
        .FitToPagesWide = 1
          .FitToPagesTall = 2
        .Zoom = False
    End With


    ActiveWindow.Zoom = 70


Rows("7:7").Select
Selection.RowHeight = 180
Range("a7:q7").Select
Selection.Merge
 With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
End With


Cells.Select

With Selection

.Locked = False
End With

Cells.Find("ebitda", lookat:=xlWhole).Select
Selection.Offset(1, 1).Select

Range(ActiveCell, "h13").Select

With Selection

.Locked = True
End With

Cells.Find("ebitda", lookat:=xlWhole).Select
Selection.Offset(1, 9).Select

Range(ActiveCell, "p13").Select

With Selection

.Locked = True
End With




Range("a1").Select


ActiveSheet.Protect userinterfaceonly:=True


ActiveWindow.FreezePanes = False

Application.ScreenUpdating = True

End Sub

您会发现您的宏将运行得更快,并且更容易调试。我会从那里开始。希望您能够使用我在上面发布的代码并完成修改您的代码,我在我停止的地方放置了一个注释块。完成此操作后,您可能会注意到问题完全消失了(因为您没有选择任何开始)。但即使你仍然有问题,解决起来也会容易得多。

这至少是我的回答,我希望它可以帮助你走上正确的道路!

于 2013-07-31T15:12:52.113 回答
0

如果您的宏在工作表之间跳转,则在选择时它可能会在错误的工作表上运行。尝试将您的选择更改为:

Worksheets("sheetname").Range("A1").Select
于 2013-07-31T14:51:07.087 回答