+ -
当前位置:首页 → 问答吧 → 为什么不能到sheet2?

为什么不能到sheet2?

时间:2011-08-06

来源:互联网

各位大侠,下面的代码为什么有问题。请指教!谢谢!

Private Sub CommandButton2_Click()


Dim j As Integer

For j = 1 To 10

    Sheets("sheet1").Cells(j, 1).Select
   
    Selection.ClearContents
   
   
     Sheets("sheet1").Cells(j, 6).Select
   
    Selection.ClearContents
   
   
    Sheets("sheet2").Cells(j, 3).Select
   
    Selection.ClearContents
   
    Next
   
   
End Sub

作者: peng_lis7   发布时间: 2011-08-06

先要激活
复制内容到剪贴板
代码:
Sub 按钮1_单击()
    Dim j As Integer
    For j = 1 To 10
        Sheets("sheet1").Select
        Sheets("sheet1").Cells(j, 1).Select
        Selection.ClearContents
        Sheets("Sheet2").Select
        Sheets("Sheet2").Cells(j, 3).Select
        Selection.ClearContents
    Next j
End Sub
[ 本帖最后由 佛山小老鼠 于 2011-8-6 19:44 编辑 ]

作者: 佛山小老鼠   发布时间: 2011-08-06

搞定了,谢谢大哥!

作者: peng_lis7   发布时间: 2011-08-06

相关阅读 更多