For i = 1 To last_row
Set mycell = ActiveSheet.Cells(i, 2)
car_num = mycell.Value
If car_num > 1 Then
mycell.Interior.ColorIndex = 2
For j = 1 To car_num <-----錯誤出現行,所以是不能將資料表格中的值當作真正的數字去跑回圈嗎??可是這是唯一判斷的數值啊..求解 TT
mycell.Rows(i).Insert
mycell.Rows(i).Copy Destination:=mycell.Rows(i + j)
a = ActiveSheet.Cells(i, car_num).Value
ActiveSheet.Cells(i, car_num).Value = a / car_num
b = ActiveSheet.Cells(i, 8).Value
ActiveSheet.Cells(i, 8).Value = b / car_num
c = ActiveSheet.Cells(i, 9).Value
ActiveSheet.Cells(i, 9).Value = c / car_num
ActiveSheet.Cells(i, 11).Value = ActiveSheet.Cells(i, 9).Value * ActiveSheet.Cells(i, 10).Value
d = ActiveSheet.Cells(i, 12).Value
ActiveSheet.Cells(i, 12).Value = d / car_num
e = ActiveSheet.Cells(i, 13).Value
ActiveSheet.Cells(i, 13).Value = e / car_num
f = ActiveSheet.Cells(i, 14).Value
ActiveSheet.Cells(i, 14).Value = f / car_num
Next j
End If
Next i
'不太會看程序請參考一下
Sub xx()
lastrow = [A65536].End(xlUp).Row ''判斷最後一列
For j = 1 To lastrow
xr = Cells(j, 1)
For i = 1 To xr
Cells(i, 4) = Cells(i, 4) / xr ''用自己除
Next
Next
End Sub作者: GBKEE 時間: 2015-6-20 14:31