excel下标越界 10

提示:Setws=Worksheets(name)下标越界,请教大侠如何解决呀!!?SubprocessOneSheet(nameAsString,ws2AsWorksh... 提示:Set ws = Worksheets(name)下标越界,请教大侠如何解决呀!!?

Sub processOneSheet(name As String, ws2 As Worksheet, ByRef nextRow As Integer)
Dim ws As Worksheet
Dim i As Integer, blankCount As Integer
Dim isFirstRow As Boolean

Set ws = Worksheets(name)
blankCount = 0
isFirstRow = True

For i = 3 To 1000
If (Len(ws.Cells(i, "N").Value) = 0 And Len(ws.Cells(i, "U").Value) = 0) Then
blankCount = blankCount + 1
If blankCount > 10 Then
GoTo PROCESS_ONE_SHEET_AFTER_FOR
End If
GoTo PROCESS_ONE_SHEET_BEFORE_NEXT_I
End If
展开
 我来答
是吖宝q
2009-02-16 · TA获得超过611个赞
知道小有建树答主
回答量:192
采纳率:0%
帮助的人:182万
展开全部
已经提示的很明白了,数组那里For i = 3 To 1000 导致的,1000改小点

不然的话中间加入判断或Try
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友e1ee4b5f5
2009-02-16 · TA获得超过350个赞
知道答主
回答量:187
采纳率:0%
帮助的人:150万
展开全部
Sub processOneSheet(name As String, ws2 As Worksheet, ByRef nextRow As Integer)
Dim ws As Worksheet
Dim i As Integer, blankCount As Integer
Dim isFirstRow As Boolean
dim j as integer

Set ws = Worksheets(name)
blankCount = 0
isFirstRow = True

j = Range("N65536").End(xlUp).Row

For i = 3 To j
If (Len(ws.Cells(i, "N").Value) = 0 And Len(ws.Cells(i, "U").Value) = 0) Then
blankCount = blankCount + 1
If blankCount > 10 Then
GoTo PROCESS_ONE_SHEET_AFTER_FOR
End If
GoTo PROCESS_ONE_SHEET_BEFORE_NEXT_I
End If

你再试试
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式