对象“_Global”的方法“范围”错误失败 [英] Error on Method 'Range' of object '_Global' failed

查看:193
本文介绍了对象“_Global”的方法“范围”错误失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个计时器。我想让计时器倒计时。这一切都行。但是,定时器需要在不同的行中进行一次,但是不应该移动到下一次,直到按下按钮。这将使我能够提取超过倒计时的时间。



任何想法? (我使用完成作为按钮,它所做的只是黑色的一个单元格)。我希望,当我这样做的时候会重置并转到下一列。

  Sub GoGo()

公开GoGo As Boolean



GoGo = True

End Sub



Sub Runn()



Dim lastrow As Long,i As Long

  For i = 23 To 32 


DoEvents
如果GoGo = True则

如果Cells(i,1)<> 0然后

范围(B5)Value = Cells(i,2).Value
Range(E5)。Value = Cells(i,3).Value
Range(E11)。Value = Range(C33)。value

Application.Run(Realcount)
Application.Run(Realcount2)

结束如果
结束如果



下一个i

End Sub

解决方案

你不能做Range(i,2)或Range (i,3)。你的意思是细胞(i,2)?


I am running a timer. I want the timer to count down the count up. This all works. However, the timer needs to go through a bunch of times in different rows but should NOT move to the next time until a button is pressed. This will allow me to extract times that went over the countdown.

Any ideas? (I am using the finish as a button, all it does is black a cell). I was hoping that when I did that the times would reset and go to the next column.

Sub GoGo()

Public GoGo As Boolean

GoGo = True

End Sub

Sub Runn()

Dim lastrow As Long, i As Long

        For i = 23 To 32


           DoEvents
            If GoGo = True Then

                If Cells(i, 1) <> 0 Then

             Range("B5").Value = Cells(i, 2).Value
             Range("E5").Value = Cells(i, 3).Value
             Range("E11").Value = Range("C33").Value

             Application.Run ("Realcount")
             Application.Run ("Realcount2")

            End If
            End If



            Next i

End Sub

解决方案

You can't do Range(i, 2) or Range(i, 3). Did you means Cells(i, 2)?

这篇关于对象“_Global”的方法“范围”错误失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆