Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have several sheets with cell-values which I want to use in a ComboBox (AddItem) - not the whole range, but only those cells with eg a bold font. How can I do this with VBA? There are also some sheets where the wanted cells are not with a bold fold, but with a "x" as value in the cell next to it (differnt column). Is there an easy way of also including these values?? Best Regards, Bmj |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() If Range("A1").Font.Bold Then Combobox1.AddItem Range(A1").Value End If If Range("H1").Offset(0,1).Value = "x" Then Combobox1.AddItem.Range("H1").Value End If -- HTH RP "Bmj" wrote in message ... Hi, I have several sheets with cell-values which I want to use in a ComboBox (AddItem) - not the whole range, but only those cells with eg a bold font. How can I do this with VBA? There are also some sheets where the wanted cells are not with a bold fold, but with a "x" as value in the cell next to it (differnt column). Is there an easy way of also including these values?? Best Regards, Bmj |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hmmm... no, it didn't work. The Combox is empty. But, this seems to work
(but only solves the bold font problem): Dim rwindex As Integer Dim colIndex As Integer For rwindex = 1 To 10 For colIndex = 1 To 10 With Worksheets("Shett1").Cells(rwindex, colIndex) If .Font.Bold = True Then Combobox1.AddItem Cells(rwindex, colIndex).Value End With Next colIndex Next rwindex Regards, Bmj "Bob Phillips" skrev i melding ... If Range("A1").Font.Bold Then Combobox1.AddItem Range(A1").Value End If If Range("H1").Offset(0,1).Value = "x" Then Combobox1.AddItem.Range("H1").Value End If -- HTH RP "Bmj" wrote in message ... Hi, I have several sheets with cell-values which I want to use in a ComboBox (AddItem) - not the whole range, but only those cells with eg a bold font. How can I do this with VBA? There are also some sheets where the wanted cells are not with a bold fold, but with a "x" as value in the cell next to it (differnt column). Is there an easy way of also including these values?? Best Regards, Bmj |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
so combine them
Dim rwindex As Integer Dim colIndex As Integer For rwindex = 1 To 10 For colIndex = 1 To 10 With Worksheets("Shett1").Cells(rwindex, colIndex) If .Font.Bold = True Or _ .Offset(0,1).Value = "x" Then Combobox1.AddItem _ Cells(rwindex, colIndex).Value End If End With Next colIndex Next rwindex -- HTH RP "Bmj" wrote in message ... hmmm... no, it didn't work. The Combox is empty. But, this seems to work (but only solves the bold font problem): Dim rwindex As Integer Dim colIndex As Integer For rwindex = 1 To 10 For colIndex = 1 To 10 With Worksheets("Shett1").Cells(rwindex, colIndex) If .Font.Bold = True Then Combobox1.AddItem Cells(rwindex, colIndex).Value End With Next colIndex Next rwindex Regards, Bmj "Bob Phillips" skrev i melding ... If Range("A1").Font.Bold Then Combobox1.AddItem Range(A1").Value End If If Range("H1").Offset(0,1).Value = "x" Then Combobox1.AddItem.Range("H1").Value End If -- HTH RP "Bmj" wrote in message ... Hi, I have several sheets with cell-values which I want to use in a ComboBox (AddItem) - not the whole range, but only those cells with eg a bold font. How can I do this with VBA? There are also some sheets where the wanted cells are not with a bold fold, but with a "x" as value in the cell next to it (differnt column). Is there an easy way of also including these values?? Best Regards, Bmj |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you :-))
"Bob Phillips" skrev i melding ... so combine them Dim rwindex As Integer Dim colIndex As Integer For rwindex = 1 To 10 For colIndex = 1 To 10 With Worksheets("Shett1").Cells(rwindex, colIndex) If .Font.Bold = True Or _ .Offset(0,1).Value = "x" Then Combobox1.AddItem _ Cells(rwindex, colIndex).Value End If End With Next colIndex Next rwindex -- HTH RP "Bmj" wrote in message ... hmmm... no, it didn't work. The Combox is empty. But, this seems to work (but only solves the bold font problem): Dim rwindex As Integer Dim colIndex As Integer For rwindex = 1 To 10 For colIndex = 1 To 10 With Worksheets("Shett1").Cells(rwindex, colIndex) If .Font.Bold = True Then Combobox1.AddItem Cells(rwindex, colIndex).Value End With Next colIndex Next rwindex Regards, Bmj "Bob Phillips" skrev i melding ... If Range("A1").Font.Bold Then Combobox1.AddItem Range(A1").Value End If If Range("H1").Offset(0,1).Value = "x" Then Combobox1.AddItem.Range("H1").Value End If -- HTH RP "Bmj" wrote in message ... Hi, I have several sheets with cell-values which I want to use in a ComboBox (AddItem) - not the whole range, but only those cells with eg a bold font. How can I do this with VBA? There are also some sheets where the wanted cells are not with a bold fold, but with a "x" as value in the cell next to it (differnt column). Is there an easy way of also including these values?? Best Regards, Bmj |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I add values of a column that are only in bold format? | Excel Worksheet Functions | |||
How do you sum just values that are bold in a list of values? | Excel Worksheet Functions | |||
Count bold text values | Excel Worksheet Functions | |||
How to bold daily max values | Excel Discussion (Misc queries) | |||
ComboBox Values | Excel Programming |