ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Values from bold cells to combobox? (https://www.excelbanter.com/excel-programming/312135-values-bold-cells-combobox.html)

Bmj

Values from bold cells to combobox?
 
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



Bob Phillips[_6_]

Values from bold cells to combobox?
 

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





Bmj

Values from bold cells to combobox?
 
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







Bob Phillips[_6_]

Values from bold cells to combobox?
 
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









Bmj

Values from bold cells to combobox?
 
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












All times are GMT +1. The time now is 10:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com