|
是这样的,我有串代码借鉴了网上的,然后运行时我发现行数一多,譬如有5万行就会提示error6错误,我想请帮忙看下问题出在哪儿了,还有,请问这个要怎么解决啊?之前有查百度,说是把%换成&,然后错误变成了error5,就改回来了,对了,之前e后面填的是65536,后来换了1048576发现还是error6错误,我就迷茫了
Sub delete_colnames()
Dim colNames
Dim i%, j%
colNames = Array("商家ID", "省份") '添加指定的列名
For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Len(Cells(1, i)) = 0 Then GoTo ghb
For j = 0 To UBound(colNames)
If Cells(1, i) = colNames(j) Then
Columns(i).Delete
Exit For
End If
Next
ghb:
Next
'在E列左边插入1列
Columns("E:E").Insert
Dim n%
n = [D1048576].End(xlUp).Row
Application.DisplayAlerts = False
Range("D2:D" & n).TextToColumns Space:=xlDelimited
Application.DisplayAlerts = True
Columns("E:E").Delete
Dim m%
m = [E1048576].End(xlUp).Row
Application.DisplayAlerts = False
Range("E2:E" & m).TextToColumns DataType:=xlDelimited
Application.DisplayAlerts = True
Selection.AutoFilter
End Sub |
|