L
leonidas
Hi,
I have the following two macros in Excel. The only thing is they take a
lot of space and time to type, because below I have the first three
objects, but it will have to be 250 objects! So can somebody help me
rewrite these two macros so that they will be a lot shorter? Thanks in
advance!
Sub ChangeComboBoxProperties()
Dim ComboBox1 As OLEObject
Dim ComboBox2 As OLEObject
Dim ComboBox3 As OLEObject
Dim ws As Worksheet
Set ws = ActiveSheet
Set ComboBox1 = ws.OLEObjects("ComboBox1")
With ComboBox1
..LinkedCell = "'Rekenblad uitgangspunten WVB'!D3"
..ListFillRange = "'Rekenblad uitgangspunten WVB'!C3:C5"
End With
Set ComboBox2 = ws.OLEObjects("ComboBox2")
With ComboBox2
..LinkedCell = "'Rekenblad uitgangspunten WVB'!D6"
..ListFillRange = "'Rekenblad uitgangspunten WVB'!C6:C8"
End With
Set ComboBox3 = ws.OLEObjects("ComboBox3")
With ComboBox3
..LinkedCell = "'Rekenblad uitgangspunten WVB'!D9"
..ListFillRange = "'Rekenblad uitgangspunten WVB'!C9:C11"
End With
End Sub
--------------------------------------------------------------------
Sub ChangeFormula()
Sheets("Begroting WVB").Activate
Range("M12").FormulaR1C1 = "'Rekenblad uitgangspunten WVB'!F3"
Range("M13").FormulaR1C1 = "'Rekenblad uitgangspunten WVB'!F6"
Range("M14").FormulaR1C1 = "'Rekenblad uitgangspunten WVB'!F9"
End Sub
I have the following two macros in Excel. The only thing is they take a
lot of space and time to type, because below I have the first three
objects, but it will have to be 250 objects! So can somebody help me
rewrite these two macros so that they will be a lot shorter? Thanks in
advance!
Sub ChangeComboBoxProperties()
Dim ComboBox1 As OLEObject
Dim ComboBox2 As OLEObject
Dim ComboBox3 As OLEObject
Dim ws As Worksheet
Set ws = ActiveSheet
Set ComboBox1 = ws.OLEObjects("ComboBox1")
With ComboBox1
..LinkedCell = "'Rekenblad uitgangspunten WVB'!D3"
..ListFillRange = "'Rekenblad uitgangspunten WVB'!C3:C5"
End With
Set ComboBox2 = ws.OLEObjects("ComboBox2")
With ComboBox2
..LinkedCell = "'Rekenblad uitgangspunten WVB'!D6"
..ListFillRange = "'Rekenblad uitgangspunten WVB'!C6:C8"
End With
Set ComboBox3 = ws.OLEObjects("ComboBox3")
With ComboBox3
..LinkedCell = "'Rekenblad uitgangspunten WVB'!D9"
..ListFillRange = "'Rekenblad uitgangspunten WVB'!C9:C11"
End With
End Sub
--------------------------------------------------------------------
Sub ChangeFormula()
Sheets("Begroting WVB").Activate
Range("M12").FormulaR1C1 = "'Rekenblad uitgangspunten WVB'!F3"
Range("M13").FormulaR1C1 = "'Rekenblad uitgangspunten WVB'!F6"
Range("M14").FormulaR1C1 = "'Rekenblad uitgangspunten WVB'!F9"
End Sub