Sub 查找一个单元格字符多于255个() Dim i As
Long Dim TMP As Range Dim Ro As
Long Dim Col As
Integer
Sheets("7.3").Select i = 0 For
Each TMP In Range("A1:iv100") i = i + 1 If Len(TMP.Text) > 255 Then
Debug.Print Sheets("7.3").Columns.Count 'Sheets("7.3").Columns.Count是一个常量,直接用256表示就可以了 Col = i - i Mod Sheets("7.3").Columns.Count ' Ro = IIf(i < Sheets("7.3").Columns.Count, 1, Num \ Sheets("7.3").Columns.Count) Ro = IIf(i < Sheets("7.3").Columns.Count, 1, i \ Sheets("7.3").Columns.Count) Cells(Ro, Col).Select 'col>256,出错 MsgBox Sheets("7.3").Cells(Ro, Col).Address(0, 0) Else End
If Next TMP End
Sub
因为有如上几处小错误,解决后算法上也不对,所以导致出错,无法继续 ...
|