ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replace based on combobox value (https://www.excelbanter.com/excel-programming/295287-replace-based-combobox-value.html)

Mike[_77_]

Replace based on combobox value
 
I currently have a combobox that shades in cells based on
a combobox value. Each cell has a formula that inputs a
cells value based on another cells value unless the value
is "0". If the value is "0" it inputs "SPARE" but if the
cell is shaded via the combobox, I want the input for
a "0" value to be "N/A".

How is this done if possible? Can I do the formula based
on the cell shading or does it have to be set to the
combobox.

Any help is appreciated,

Mike

Dave Peterson[_3_]

Replace based on combobox value
 
Is all this work done by code?

If yes, then maybe you can just check the values and the shading (does shading
mean fill color?).

Option Explicit
Sub testme01()
With ActiveSheet
If .Range("a1").Value = 0 Then
If .Range("b1").Interior.ColorIndex = 6 Then
.Range("b1").Value = "N/A"
Else
.Range("b1").Value = "SPARE"
End If
Else
'not sure what happens here
End If
End With

End Sub

I used a .colorindex of 6. Probably not what you're using.

(But I'm not sure if I understood the question.)

Mike wrote:

I currently have a combobox that shades in cells based on
a combobox value. Each cell has a formula that inputs a
cells value based on another cells value unless the value
is "0". If the value is "0" it inputs "SPARE" but if the
cell is shaded via the combobox, I want the input for
a "0" value to be "N/A".

How is this done if possible? Can I do the formula based
on the cell shading or does it have to be set to the
combobox.

Any help is appreciated,

Mike


--

Dave Peterson



All times are GMT +1. The time now is 05:22 AM.

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