View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Aksel Børve Aksel Børve is offline
external usenet poster
 
Posts: 21
Default shortening a macro

Anyone who can help me write the macro below a little shorter.
MVH Aksel

Private Sub ComboBox1_Change()
Application.ScreenUpdating = False
Sheets("Sheet1").Unprotect
If ComboBox1.Value = "NONE" Then
With Me.Range("K8")
.FormulaR1C1 = ""
With Me.Range("M8")
.FormulaR1C1 = ""
End With
End With
Else
If ComboBox1.Value = "2 7/8'" Then
With Me.Range("K8")
.FormulaR1C1 = "0,0145"
With Me.Range("M8")
.FormulaR1C1 = "0,0123"
End With
End With
Else
If ComboBox1.Value = "4'" Then
With Me.Range("K8")
.FormulaR1C1 = "0,0348"
With Me.Range("M8")
.FormulaR1C1 = "0,0177"
End With
End With
Else
If ComboBox1.Value = "5 7/8'" Then
With Me.Range("K8")
.FormulaR1C1 = "0,0839"
With Me.Range("M8")
.FormulaR1C1 = "0,0298"
End With
End With
Else
If ComboBox1.Value = "4'HW" Then
With Me.Range("K8")
.FormulaR1C1 = "0,0209"
With Me.Range("M8")
.FormulaR1C1 = "0,0333"
End With
End With
Else
If ComboBox1.Value = "5 7/8'HW" Then
With Me.Range("K8")
.FormulaR1C1 = "0,051"
With Me.Range("M8")
.FormulaR1C1 = "0,0686"
End With
End With
Else
If ComboBox1.Value = "DC" Then
With Me.Range("K8")
.FormulaR1C1 = ""
With Me.Range("M8")
.FormulaR1C1 = ""
End With
End With
Else
If ComboBox1.Value = "6 3/4'DC" Then
With Me.Range("K8")
.FormulaR1C1 = "0,0252"
With Me.Range("M8")
.FormulaR1C1 = "0,0948"
End With
End With
Else
If ComboBox1.Value = "8'DC" Then
With Me.Range("K8")
.FormulaR1C1 = ""
With Me.Range("M8")
.FormulaR1C1 = ""
End With
End With
Else
If ComboBox1.Value = "8 1/4'DC" Then
With Me.Range("K8")
.FormulaR1C1 = "0,0287"
With Me.Range("M8")
.FormulaR1C1 = "0,1596"
End With
End With
Else
If ComboBox1.Value = "8 3/4'DC" Then
With Me.Range("K8")
.FormulaR1C1 = ""
With Me.Range("M8")
.FormulaR1C1 = ""
End With
End With
Else
If ComboBox1.Value = "9 3/4'DC" Then
With Me.Range("K8")
.FormulaR1C1 = "0,2456"
With Me.Range("M8")
.FormulaR1C1 = "0,2743"
End With
End With
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
With Me.Range("J24")

End With
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub