下面的語句出錯,因沒用過VB,再請WWWB指點
For i = 1 To ActiveSheet.UsedRange.Columns.Count
For j = 1 To ActiveSheet.UsedRange.Rows.Count
If Worksheets("Sheet1").Range.Cells(j, i).Values = 0 Then Selection.ClearContents
Next j
Next i
这样也不行
Dim i, j As Integer
For i = 1 To ActiveSheet.UsedRange.Columns.Count
For j = 1 To ActiveSheet.UsedRange.Rows.Count
Worksheets("Sheet1").Activate
If ActiveSheet.UsedRange.Cells(j, i).Values = 0 Then ActiveSheet.UsedRange.Cells(j, i).Values.ClearContents
Next j
Next i
解决了,谢谢WWWB.是用VBDim i, j As Integer
For i = 1 To ActiveSheet.UsedRange.Columns.Count
For j = 1 To ActiveSheet.UsedRange.Rows.Count
With ActiveSheet.UsedRange.Cells(j, i)
If .Value = 0 Then .ClearContents
End With
Next j
Next i