Board logo

標題: 簡化程式 [打印本頁]

作者: bear0925900003    時間: 2014-1-7 17:16     標題: 簡化程式

煩請大大幫忙簡化一下下列程式,不勝感激!!
For i = 6 To 45
If Range("c" & i) = "" Then
Range("e" & i) = ""
End If
If Range("c" & i) = "" Then
Range("f" & i) = ""
End If
If Range("c" & i) = "" Then
Range("g" & i) = ""
End If
If Range("c" & i) = "" Then
Range("h" & i) = ""
End If
If Range("c" & i) = "" Then
Range("i" & i) = ""
End If
If Range("c" & i) = "" Then
Range("j" & i) = ""
End If
If Range("c" & i) = "" Then
Range("k" & i) = ""
End If
If Range("c" & i) = "" Then
Range("l" & i) = ""
End If
If Range("c" & i) = "" Then
Range("m" & i) = ""
End If
If Range("c" & i) = "" Then
Range("n" & i) = ""
End If
Next
作者: GBKEE    時間: 2014-1-7 17:26

回復 1# bear0925900003
  1. Option Explicit
  2. Sub Ex()
  3.     Dim i
  4.     For i = 6 To 45
  5.         If Range("c" & i) = "" Then Range("e" & i & ":n" & i) = ""
  6.     Next
  7. End Sub
複製代碼

作者: bear0925900003    時間: 2014-1-7 17:49

就這麼簡單???感謝大大我腦殘了!!




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)