Merhaba arkadaşlar,
Aşağıdaki gibi bir döngü kodu var. Buradaki örnek olarak kısaltılmış, aslı benzer şekilde uzayıp gidiyor. C sütunundaki değerleri aşağıdaki döngüdeki değerlere göre D sütununa "Salt", "U1", "U2" olarak 3 grup halinde yazıyor.
Bu kodu daha kısa bir şekilde nasıl yazabiliriz acaba?
KOD:___________________________________________
For Each Grup In Range("C2:C65536")
If Grup.Value = "SY" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "Salt"
End With
ElseIf Grup.Value = "24V" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "Salt"
End With
ElseIf Grup.Value = "U1Gen" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "U1"
End With
ElseIf Grup.Value = "U1Temp" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "U1"
End With
ElseIf Grup.Value = "U2Gen" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "U2"
End With
ElseIf Grup.Value = "U2Temp" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "U2"
End With
End If
Next
Aşağıdaki gibi bir döngü kodu var. Buradaki örnek olarak kısaltılmış, aslı benzer şekilde uzayıp gidiyor. C sütunundaki değerleri aşağıdaki döngüdeki değerlere göre D sütununa "Salt", "U1", "U2" olarak 3 grup halinde yazıyor.
Bu kodu daha kısa bir şekilde nasıl yazabiliriz acaba?
KOD:___________________________________________
For Each Grup In Range("C2:C65536")
If Grup.Value = "SY" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "Salt"
End With
ElseIf Grup.Value = "24V" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "Salt"
End With
ElseIf Grup.Value = "U1Gen" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "U1"
End With
ElseIf Grup.Value = "U1Temp" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "U1"
End With
ElseIf Grup.Value = "U2Gen" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "U2"
End With
ElseIf Grup.Value = "U2Temp" Then
With Grup.Offset(0, 1).Cells
.FormulaR1C1 = "U2"
End With
End If
Next
