应用程序定义或对象定义错误 5
PublicSub统计调查问卷结果()Dimi,j,tAsIntegerDimCountAsIntegerDimTempAsVariantCount=Sheets("Sh...
Public Sub 统计调查问卷结果()
Dim i, j, t As Integer
Dim Count As Integer
Dim Temp As Variant
Count = Sheets("Sheet3").[A1].CurrentRegion.Rows.Count
Sheets("Sheet4").Select
For Each Temp In Range("B4:M9")
Temp.Value = ""
Next Temp
Sheets("Sheet3").Select
For i = 4 To Count
For j = 1 To 12
Select Case Cells(i, j)
Case 1
Worksheets("Sheet4").Cells(4, t) = Worksheets("Sheet4").Cells(4, t) + 1
Case 2
Worksheets("Sheet4").Cells(5, t) = Worksheets("sheet4").Cells(5, t) + 1
Case 3
Worksheets("Sheet4").Cells(6, t) = Worksheets("sheet4").Cells(6, t) + 1
Case 4
Worksheets("Sheet4").Cells(7, t) = Worksheets("sheet4").Cells(7, t) + 1
Case 5
Worksheets("Sheet4").Cells(8, t) = Worksheets("sheet4").Cells(8, t) + 1
Case 6
Worksheets("Sheet4").Cells(9, t) = Worksheets("sheet4").Cells(9, t) + 1
End Select
Next j
Next i
Sheets("Sheet4").Select
End Sub
Case1 下面那一行代码显示为亮黄色,并且提示应用程序定义错误或对象定义错误,1004,大神求助,这个怎么破? 展开
Dim i, j, t As Integer
Dim Count As Integer
Dim Temp As Variant
Count = Sheets("Sheet3").[A1].CurrentRegion.Rows.Count
Sheets("Sheet4").Select
For Each Temp In Range("B4:M9")
Temp.Value = ""
Next Temp
Sheets("Sheet3").Select
For i = 4 To Count
For j = 1 To 12
Select Case Cells(i, j)
Case 1
Worksheets("Sheet4").Cells(4, t) = Worksheets("Sheet4").Cells(4, t) + 1
Case 2
Worksheets("Sheet4").Cells(5, t) = Worksheets("sheet4").Cells(5, t) + 1
Case 3
Worksheets("Sheet4").Cells(6, t) = Worksheets("sheet4").Cells(6, t) + 1
Case 4
Worksheets("Sheet4").Cells(7, t) = Worksheets("sheet4").Cells(7, t) + 1
Case 5
Worksheets("Sheet4").Cells(8, t) = Worksheets("sheet4").Cells(8, t) + 1
Case 6
Worksheets("Sheet4").Cells(9, t) = Worksheets("sheet4").Cells(9, t) + 1
End Select
Next j
Next i
Sheets("Sheet4").Select
End Sub
Case1 下面那一行代码显示为亮黄色,并且提示应用程序定义错误或对象定义错误,1004,大神求助,这个怎么破? 展开
展开全部
能把完整的贴出来不,这个没法看你的具体错误。Rows("i:i").比如这个,i是变量也不起作用了,也不明白你要做什么。我想你是想这样吧:Rows(i & ":" & i).Insert shift:=xlUp
追问
已经是完整的了,我想通过上面的宏把Sheet3中的结果再统计到一个新建的工作表Sheet4中,代码Case1
Worksheets("Sheet4").Cells(4, t) = Worksheets("Sheet4").Cells(4, t) + 1
意思是:如果Sheet3中单元格值为1,则Sheet4中对应的单元格的统计数值加1
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询