Recalculate Custom Function With Cell Format Change
Oct 2, 2007
I saw there were codes to sum or count cells that have a specified Fill Color
http://www.ozgrid.com/VBA/sum-count-cells-by-color.htm
However it says the changing of a cells fill color will not cause the Custom Function to recalculate, I really need to recalculate the data if there are any changes in the selected range
View 6 Replies
ADVERTISEMENT
May 31, 2008
I have this spreadsheet with tons of vba coding. The intent of the spreadsheet is to track invoices as it goes through the approval process. The part that is giving me issues is the first and seventh column. The seventh column is actually a formula that returns how many days between the invoice due date and today’s date. The coding works fine, with one small glitch. Once the dates have been entered, the first column (which contains the color-coding) stops changing colors. What it should do is anything with 0 or less days remaining should show red, between 1 to 10 days, show yellow and anything above 10 days, show green.
So if I enter an invoice with 11 days remaining to pay, it will show green in the first column, but when I open the spreadsheet tomorrow, it remains green, even though it should show yellow.
What I want it to do is refresh every time it is opened, or every day, which ever is easier. There are reasons that we cannot use conditional formatting, one of them being that we want to expand the color coding system to more than 3 colors soon, but I want to get this working correctly first.
This is what I have. I cannot attach the spreadsheet because it contains confidential information.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim h As Integer
Dim i As Integer
Dim j As Integer
Dim lastRow As String
Dim fRowValue As String
Dim gRowValue As String
Dim mRowValue As String
Dim rRowValue As String
Dim uRowValue As String
Dim paidCheck As String
Dim stringAnswer As String
Dim testAnswer As String
Dim testDate As String
Application. ScreenUpdating = False
lastRow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
For j = 8 To lastRow
If Not Intersect(Cells(j, 2), Target) Is Nothing Then ...................
View 9 Replies
View Related
Aug 22, 2013
Is it possible to change cell format from custom to general or text and keep the cell value
I have this in formula bar: 16/08/2013 4:37:00 AM
which is displayed in the cell as: 16/08/2013 4:37
I want to change the cell format to general but display the same information.
View 2 Replies
View Related
Mar 10, 2008
I'm trying to build a price index in which when a user changes the value in any one cells, the other cells on that row would change dynamically. In other words, if a user enters 25% in the "discount %" column, the "net price" column would reflect this discount ( attached is a sample sheet). I thought I had this covered but ran in to some problems I can't figure out on my own.
The worksheet_change function only inserts a formula in to a cell once. After a value has been added to that cell manually, the function doesn't insert the formula in it again. Also, there are empty cells inside the price index and I don't know how to take them into consideration in my code. And for last, if, and only if a discount % is entered a phrase "Z106" should appear in the last column. But if any of the net prices are manually entered, a phrase "ZSOP" should appear in the last column.
View 8 Replies
View Related
Mar 3, 2013
The attached file contains data. In Worksheet 1 (and also 2 and 3) column B2 shows day, month, year, hours, minutes and seconds. I was hoping to convert this to just Hours and Minutes, but all the usual methods using Custom Format does not work. This leads me to think that its in TEXT format. How can I change Column B2 to Hours and Minutes?
View 14 Replies
View Related
Feb 21, 2014
I have a column in excel which gets populated in the format "2/1/1980" when copied from a different source. I want a macro to run on this column and convert this in the below format. Required format: '02-01-80 (note the ' symbol before 02 which will keep it as text)
Existing ----> Required
2/1/1980 --> '02-01-80
2/1/1970 --> '02-01-70
2/1/1983 --> '02-01-83
I need this macro to run on two columns and replace them with the required format. I can do a find and replace either in the sheet or through hard coding the VBA, but as the date format keeps growing, I would need to do this via code and hence requesting the same.
View 4 Replies
View Related
Aug 30, 2009
I'm working on a workshet where ppl fill in vehicle numbers, but they all find their own unique ways to fill them up. Some of the examples are below:
MH 04TN 2315
HR 38G 9605
9605G
H9425
TN04A8451
GJ04 GA5142
KA 0072
3,4,7 are incomplete nos. while 1,2,5,6 are all complete nos. I want the format of these above nos. to look like this:
2315TN/MH04
9605G/HR38
9605G
9425H
8451A/TN04
5142GA/GJ04
0072KA
Can this be done automatically in a worksheet using the custom cell format function??.... because then it wud get formatted as necessary whenever someone enters a vehicle no. in that particular column.
View 4 Replies
View Related
Feb 8, 2013
custom formatting a cell for accommodate a Canadian postal code. The postal code looks like this
v9s 2k5. 7 charactors l#l #l#. I would like to quickly enter the data and have excel capitalize the letters and add the space for me.
View 1 Replies
View Related
May 31, 2009
is it possible to custom format a cell in order to:
a) Present 3.33333 as 3.33 (max. of 2 decimal digits or less)
b) Present 3.333 as 3.33
c) Present 3.33 as 3.33
d) Present 3.3 as 3.3
e) Present 3 as 3 (NO zeros and NO decimal dot)
View 5 Replies
View Related
Apr 14, 2013
I want to create a custom format for a cell for entering in "cup measurements". I want to be able to type in 5, 1/4, 1/16, etc. and have the word "cups" appear after the number in that cell. I formatted the cell to say the word cups after typing in the numbers in my cell using the code "cups".
ex: 0 "cups" works fine for whole number
so then if i change it to 0/0 "cups" is works great for only 1/8 but not 1/16 or whole numbers. Then I looked at other custom codes that already existed in my formatts so I attempted to try this code which I just kinda came up with
_(0/00);_(0);_(0/0); "cups"
well it isn't doing what I want and If I use the 0/00 "cups code and I type in 4 cups the cell then says 4/01 cups.
What does my code need to be for me to show whole numbers and and size fraction without having it look weird?
View 2 Replies
View Related
Jul 16, 2014
In Excel I have a field which requires as 14-char alphanumerical value such as AB1D520DGFSF12
I would like Excel to format it as
AB1D5.20DG.FS.F12
How can I achieve this?
View 2 Replies
View Related
May 22, 2013
Data in a cell is formatted in h:mm which is truly a result of a calculation of # of hours & minutes detained at a location. D
Data is result of microstrategy query so result is
E.g. 17:08
Cell is formatted as custom h:mm, but there is actually a fictitious date of 1/1/1900 defaulting in front of h:mm when double clicking into cell or viewing in fx field above. How do I get rid of that date which is inhibiting me from converting 17:08 to minutes by using the formula of =TEXT(L3,"[m]")
View 3 Replies
View Related
Aug 21, 2013
Are there any custom formats i could use to center align a particular text in a cell if it is chosen in a dropdown validation (example: N/A)?
I would like "N/A" to be aligned in the center and all other choices aligned to the left.
View 1 Replies
View Related
Nov 11, 2009
On the attached example, there is a user form with a text box and an enter button.
What i want, is when i press the enter button, the value in the text box goes into cell B2 on sheet1 in the format of "?/???".
View 2 Replies
View Related
May 5, 2014
In cell 'I6' if I enter the text "Balance" I would like it to display as "Actual" but if any other text is entered I would like it to display the text entered. How to do this using custom cell formatting. (Currently on Excel 2010).
View 2 Replies
View Related
Oct 1, 2009
I have a workbook in Excel 2007 with several sheets imported from other workbooks. In the course of this, one of them has brought several custom cell styles with it and I would like to be rid of them, as they clutter up the cell styles gallery.
Most of them were cooperative and deleted simply enough by right-clicking and selecting 'Delete', but one is proving a little more stubborn.
When I mouse over it, it plays the 'alert' noise (the 'bink' you get when Excel wants to alert you to something) and then nothing happens. There is no noticeable change to text or cell, as there should be thanks to 2007's previewing ability. Trying to apply the style results in the message
"Style '
386grabber=VGA.3GR
' not found."
(the line breaks are present in the message and seem to be because the style name actually has character returns as the first and last characters).
Is there a way to delete this style, or am I going to have to resign myself to having an annoying noise every time I try to apply styles
View 9 Replies
View Related
Feb 10, 2010
I am trying to write a custom cell format that would allow me to replace the comma with a space after the thousand's place. Therefore, 1 million would look like: 1 000 000 instead of 1,000,000. I do NOT want to change my regional settings to accomplish this.
When I write ### ### ### it accomplishes this, however, there is one small glitch. When you apply an "underline" you get the following result:
_1
_10
_100
_1 000
_10 000
_100 000
1 000 000
10 000 000
100 000 000
The underline does not lineup evenly with the "ones" digit until we reach 1 million. I want to write a universal format in which the underline lines up evenly regardless of the number.
View 13 Replies
View Related
Jun 12, 2008
I would like to have a single button that changes a range of cells from the USD to EURO to perhaps CAD symbol. Can this operation be performed, such that if I start in dollars, and I click the button once, it shifts by range to EURO (not formulas...just symbol)...and then if I click the same button again, it goes to CAD, and then back to USD with a third click?
View 5 Replies
View Related
Feb 8, 2013
Basically i want to use a UDF to count cells in a range of a certain colour.
But i want to make it easy for the user to be able to change the colour the function counts, so i thought i could ask them to colour the cell in which the function is written.
Is there a way to tell the function to pick up the Interior.ColorIndex of the cell it is written in?
Use Application.caller.interior.colorindex
View 2 Replies
View Related
Apr 27, 2008
I’m trying to write a custom function that always references the cell above it but I can’t figure out the proper syntax to do so i.e.
Function Multiple_Cell_Above()
Multiple_Cell_Above = cellabove * 10
End function
View 9 Replies
View Related
Jun 13, 2013
How to modify a custom cell format to make data entry easier.
My goal is to have the output look like this: 'A12B-C20D: SET 10: Text string here'
Inputs needed are:
1-3 digit number between A & B
1-3 digit number between C & D
1-2 digit number after SET
Text string of variable length
Where I am stuck. So far I can get "A12B-C20D: SET 10:" to show up properly when 122010 is input. The custom format I am using looks like this: "A"##"B-C"##"D: SET "##": "
When I try to incorporate the "@" symbol the first part of the formatting goes away and the output shows up as "122010 Text string here".
I have tried:
"A"###"B-C"###"D: SET "##":";;-;_@
"A"###"B-C"###"D: SET "##": ";;@
"A"###"B-C"###"D: SET "##":";_@
"A"###"B-C"###"D: SET "##": ";;;@
View 4 Replies
View Related
Mar 5, 2008
I'm trying to create a user-defined function, but the function needs to know what cell it has been placed in. I want to use this cell reference to get some other offset values. I can easily find out offset values based on the ActiveCell, but not for those offset values based on where the UDF is actually placed, which could be almost anywhere on the worksheet.
View 5 Replies
View Related
Aug 5, 2008
I understand the specification of a Function procedure does not provide for it to change the contents of cells. However, I have the need/preference to be able to change cell data by using a custom function (instead of a Sub) because of its ease of use and execution of multiple what-if scenarios - displayed jointly.
Is there a way around this specification/limitation - any way? Are there different techniques (standard or non-standard) to achieve thisr goal?
View 8 Replies
View Related
Jul 26, 2006
How does one pick up the data contained in a worksheet cell (say B5) and use it in the vba code of a custom function without passing the cell as an arguement
View 3 Replies
View Related
Mar 6, 2014
How would you write a custom function that you could plug in a cell that would do the following.
If the value in the cell is greater than 0, traverse up that column to clear the values until it reaches the cell in that column that has been colored orange.
View 3 Replies
View Related
Jan 10, 2014
i have some existing code which is trigerred when anything is input into column c. The code then adds various information in another three columns. One of which pastes a vlookup formulae, and i would like this forumlae pasted into the column c cell which i initialy edited, in order to remove the requirement for one additional column.
The existing code i have is:
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim MyText As String
MyText = Environ("username")
If Target.Cells.Column = 3 Then
With Target
If .Value "" Then
.Offset(0, 2).Formula = "=VLOOKUP(D:D,'P:TAOffshoreTAOffshoreTreasuryRecsGeneralCommit ID''s for control Sheet - Do not move or delete[commit ids - DO NOT DELETE OR MOVE.xls]Sheet1'!$A$1:$B$65536,2,0)"
[code].....
I have tried changing the offset to (0,0) or changing the offset to 'target = ', which does add in the vlookup but then the macro debugs at the 'If .Value "" Then' code?
View 3 Replies
View Related
Jul 3, 2009
I am performing a lookup using the populare user defined function nlookup, which does not take a lookuparray argument to find lookup values. But I only want to return lookup values that fall into a certain array. To accomplish this, I figured out that I need a way to specify a condition of the type "if cell address of lookup value falls within range"
It should be possible if I find a way to return the cell address of the nlookup value, but as nlookup is not limited by a lookuparray argument, so I was not able to use the address/index/match that come up in similar questions.
View 3 Replies
View Related
Dec 16, 2013
I have a cell which sums up a lot of random number generators (after going through several other functions) and therefore every time the worksheet recalculates the value of this cell changes.
Is there any way I can get this cell to print it's value say, 1000 times, each print one cell below the previous, with a recalculate in-between each print? I'm guessing this needs scripts? Or is there a way of just directly inputting this into 1000 cells and letting it fly?
Cell formula: =(COUNTIF(BB:BB,"yes"))/COUNTIF(BB:BB,"no")
View 2 Replies
View Related
Jan 25, 2014
I need to create a drop down menu or something of that sort, that allows the user to select what units he wants his results to be in.
When a particular units system is selected, the results must be recalculated and displayed in their respective cells.
No matter which units are selected, the units must always be displayed in the same set of cells, that means the formula or reference in the set of those output cells must change automatically, based on the units selection.
View 8 Replies
View Related
Nov 11, 2008
My workbook in Excel 2003 is set to manual re-calculation to save constant updating of all the worksheets.
However, I have 2-3 worksheets where I have a drop list box containing dates and I would like all of the information in that particular worksheet to update itself when the date changes.
e.g. If dropdown list box in B2, when changed from 4/10/08 to 11/10/08 all formulas etc are updated.
Have done a search but the only examples I can find are ones where the worksheet updates itself whenever any cell is changed.
View 8 Replies
View Related