excel中关于数据类型的一个简单问题
单元格内为仅粘帖数值格式,然后如下代码为何运行不过去呢Subshuliangtongji()DimiAsIntegerDimmaxrAsIntegermaxr=Appli...
单元格内为仅粘帖数值格式,然后如下代码为何运行不过去呢
Sub shuliangtongji()
Dim i As Integer
Dim maxr As Integer
maxr= Application.WorksheetFunction.CountA(ThisWorkbook.Worksheets("sheet1").Range("A:A"))
Dim lh1y As Integer
xk1y = 0
With Sheet1
For i = 2 To maxr
If .Cells(i, 6).Value= "2月" Then
xk1y = xk1y + 1
End If
Next
End With
MsgBox xk1y
End Sub
If .Cells(i, 6).Value= "2月" 老是提示类型不匹配怎么回师呢
2月不是日期啊,应该是文本,一楼的不管用啊,能否在指导以下
关键是类型不匹配啊, 展开
Sub shuliangtongji()
Dim i As Integer
Dim maxr As Integer
maxr= Application.WorksheetFunction.CountA(ThisWorkbook.Worksheets("sheet1").Range("A:A"))
Dim lh1y As Integer
xk1y = 0
With Sheet1
For i = 2 To maxr
If .Cells(i, 6).Value= "2月" Then
xk1y = xk1y + 1
End If
Next
End With
MsgBox xk1y
End Sub
If .Cells(i, 6).Value= "2月" 老是提示类型不匹配怎么回师呢
2月不是日期啊,应该是文本,一楼的不管用啊,能否在指导以下
关键是类型不匹配啊, 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询