Excel formula do not update automatically - excel

I have created a simple excel formula to know what is the color of the font of the cell A1
Function GetFontColorIndex(elrango As Range) As Integer
Application.Volatile
GetFontColorIndex = elrango.Cells(1, 1).Font.ColorIndex
End Function
In excel-2010:
File > Options > Formulas > Workbook Calculation > Automatic is checked
In cell A1 I have a number, and in cell A3 I have
=GetFontColorIndex(A1)
but when I change the font of cell A1, the formula does not update automatically on cell A3. I have to click shift+F9 and then it works.
Any idea why is not showing the number of the font automatically?

As simoco has mentioned.
If you are using your 'udf' in Sheet1 then in the module associated with that sheet add the following:
If you just change the colour the formula does not update but as soon as you press enter or select another cell in the sheet it updates

Related

Formula for colour a cell

Need to fill a colour into the cells individually, if condition gets OK. Each cell with reference of different cell.
Means
if value of C1 is not between A1 & B1, C1 fills with red,
likewise,
if value of C2 is not between A2 & B2, C2 fills with red
if value of C3 is not between A3 & B3, C3 fills with red..
In Excel, the Conditional Formatting can do this
Select the range of cells, and click Home > Conditional Formatting > New Rule.
Then in the New Formatting Rule dialog, select Use a formula to determine which cells to format in the Select a Rule Type list, and type this formula =OR(C1<A1,C1>B1) into the Format values where this formula is true textbox, and click Format button to enable the Format Cells dialog, under Fill tab, and select one color you want to use for highlighting. See screen-print
Click OK > OK. Then the cells which are not in the number range have been highlighted

Refer to a sheetname from a cell in excel

I have the following postcode in Cell C2 IV243DLR of excel
In cell C3 I have the following formula
=cleancode(OFFSET(IV243DLR!$C$1,10,ROW()-3))
I have clicked on the tab called IV243DLR for this offset to work.
However what i wish to do is create the same formula using the postcode in Cell C2, since i have different postcodes in D2, E2 etc. Therefore my aim is to create the sheetname using the contents of the cell rather than clicking on each tab. I dont know the syntax on how to create a sheetname using cells. Can someone assist?

Auto fill cells in excel from drop down list

I just want to know how to autofill all cell if I select value from 1 cell using drop down box. Suppose in 1st cell of the row I will select "Yes", then all the 5 adjacent cell of that row will also show "Yes". ther is data validation activated in all cell, but i dont need to select it each time.
If the dropdown is in A1 then just make B1 be:
=A1
so it shows whatever is in cell A1

Excel formula refer to cell to the right, in frozen pane

I can usually find all the answers I need through Google searches. This one has me stumped; maybe it isn't possible.
My sheet is set up with B5 as its first unfrozen cell. How can I enter a formula in cell A3 that refers to the first cell that is currently showing in the top right pane? So in the worksheet's initial state, A3 would refer to B3, but if I scrolled right 10 rows, for instance, A3 would then refer to K3.
Excel uses cell references in formulas. A cell reference does not change when you scroll. You would need VBA to determine the top left cell of a pane. This cell value can be written into a helper cell and you could reference that helper cell in the formula in the frozen pane.
The VBA would run as a Selection Change event, i.e. when the user clicks in a different cell or uses the keyboard to navigate. It would not work for scrolling with the mouse wheel, since that is not an event in the Excel object model. (Chip Pearson has some code for that, though, here).
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Integer, pane As Integer
Dim PaneTop As String
pane = ActiveWindow.Panes.Count
PaneTop = ActiveWindow.Panes(pane).VisibleRange.Address
i = InStr(PaneTop, ":")
PaneTop = Left(PaneTop, i - 1)
Range("A3").Formula = "=" & PaneTop
End Sub
This function puts a cell reference to the top left cell of the pane into A3. Change it to include your formula, or write it to a different cell and let your formula refer to that cell.

Excel formula not executing on run time with selecting and double click on the particular cell

My scenario is , I have one Excel sheet. On the same sheet in cell A2 I am inserting the data through code and cell B2 I already put the data manually before inserting the data in cell A2, in cell C2 I written the formula =EXACT(A2,B2).
Now when I run the code, the code put the value in cell A2,and the Status should be change according to the condition given and the data on both cells. But it doesn't change the status according to the formula in cell C2 and the status gets changed when I double click on that particular cell and enter then the condition work. Please tell me how it will be possible without double click on the particular cell?
This works (I've tested it) if automatic calculation is switched on (Excel Options->Formulas->Calculation Options).
Here's the code (I'm using A1, B1, C1):
Private Sub CommandButton1_Click()
Cells(1, 1).Value = 2
End Sub

Resources