I have this code that change font size form an cell in excel to all ListBox I have
Dim FontSize As Integer
FontSize = Worksheets(7).Range("B1")
Set xLstBox = ActiveSheet.AddOptInletTable
Set xLstBox2 = ActiveSheet.AddOptInletTableCombi
Set xLstBox3 = ActiveSheet.AddOptLHF6114
Set xLstBox4 = ActiveSheet.AddOptKL30Special
Set xLstBox5 = ActiveSheet.AddOptLKS6114
xLstBox.Font.Size = FontSize
xLstBox2.Font.Size = FontSize
xLstBox3.Font.Size = FontSize
xLstBox4.Font.Size = FontSize
xLstBox5.Font.Size = FontSize
What I want is an code that make this Change to all Listbox without having to update the code ..Even if I add more listbox later.. is there not a way to run this maybe by index and simple make a count and run through all of the Listbox ?
something like this
Dim FontSize As Integer
FontSize = Worksheets(7).Range("B1")
For i=1 to Listbox.count-1 then
ListBox(i).Font.Size =FontSize
next i
I am very new at this so hope you can help
Dim FontSize As Integer
FontSize = Worksheets(7).Range("B1")
Set xLstBox = ActiveSheet.AddOptInletTable
Set xLstBox2 = ActiveSheet.AddOptInletTableCombi
Set xLstBox3 = ActiveSheet.AddOptLHF6114
Set xLstBox4 = ActiveSheet.AddOptKL30Special
Set xLstBox5 = ActiveSheet.AddOptLKS6114
xLstBox.Font.Size = FontSize
xLstBox2.Font.Size = FontSize
xLstBox3.Font.Size = FontSize
xLstBox4.Font.Size = FontSize
xLstBox5.Font.Size = FontSize
What I want is an code that make this Change to all Listbox without having to update the code ..Even if I add more listbox later.. is there not a way to run this maybe by index and simple make a count and run through all of the Listbox ?
something like this
Dim FontSize As Integer
FontSize = Worksheets(7).Range("B1")
For i=1 to Listbox.count-1 then
ListBox(i).Font.Size =FontSize
next i
I am very new at this so hope you can help