Automatically Calculate Cell When Changed

Oct 24, 2006

There is a column in my spreadsheet which needs to reflect a " percent done".
I used to enter just a numerical value in (eg. 20) to reflect 20% done. My boss wanted it to show as an actual percentage (eg. 20%). I changed the format to Percent, Zero decimal places. Then you had to enter .20 to get the 20% to show.
Now my boss doesn't like that - and wants to be able to enter "20" to get the 20% to show. I put the following code in my SelectionChange event...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'other logic
If Target.Column = Asc(PercentDoneColumn) - 64 Then
If Target.Value <> "" Then
Target.Value = Target.Value / 100
End If
End If
'end other logic
End Sub

My problem is that this works well when putting a new percentage in, but not for when you click on a cell that already has a percentage in it. For example, if you have .2 (displaying "20%" in the cell), and click on that cell, it divides that number by 100, and gives you 0.2%, displaying as "0%". I want to enter a number between 0 and 100, have it displayed and stored as a percent. At this point, I'd settle for the displayed, but would prefer to have it stored as a percent, too.
I also want it to not reset my value unless I'm putting a new value in!

View 4 Replies


ADVERTISEMENT

Automatically Calculate 2 Cells Based On Cell Changed

Apr 25, 2009

I have some rather complex formulas that when a value is placed in one of any three cells it solves for the other two, taking values from other places on a worksheet (including the cell itself).

Scenario: Cell F10, G10, and H10 all have formulas in them. If a value is placed in F10 it solves for G10 and H10. If a value is place in G10 it solves for F10 and H10. If a value is placed in H10, it solves for F10 and G10.

I really do not think the actual formulas matters at this time...

Has anyone done this before, using VBA code to place the formulas in cells F10 G10 and H10? Look for a working example of this if possible.

View 9 Replies View Related

Calculate Cells When Another Cell Is Changed

Jul 25, 2014

I'm after some vb code that will only allow the range - PRODUCT_Selections!A2:C370 to calculate, when something is changed in the range - Input!T11:V500

I would like all other calculations in the workbook to continue as normal.

View 9 Replies View Related

Automatically Save My Workbook When A Certian Cell Range Is Changed

Jul 21, 2009

I am very new to vba and trying to figure out an auto save macro that will automatically save my workbook when a certian cell range is changed. Right now I have a macro set that automactially record the time and date of when a change is made to the name cell, I want to set up a macro that will automatically save the file when the time is updated.

This program is used by several users and they have a tendnecy to forget to save the program so that when other people want to check the updated data nothing has changed because the changes have not been saved. I have attached the file that I am working on. When a change is made in column F then Column G automatically updates, now I want column G to trigger autosave. I would also like a msgbox to appear to tell user that file has been saved.

View 3 Replies View Related

Automatically Add Username, Current Date And Time Each Tiime Any Cell Is Changed

Feb 27, 2009

I am looking to have a macro which will automatically add the username and date to a cell, when the cell above changes (or in this case =x). I have a bit of code from a previous project, but I have changed Target.Row to Target.Column and it is not behaving as I require:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("B2:BZ2"), Target) Is Nothing Then
Range("C" & Target.Column).Value = Format(Date, "dd-mmm") & " " & Format(Time, "hh:mm") & " by " & (Application.UserName)
End If
End Sub

See the attachment for the example. What I need is whenever row 3 ="x" I need the corresponding cell in row "d" to update with the latest date, time and username. Please not the macro is currently not active on the sheet as i've added the ' character.

View 3 Replies View Related

Automatically Call Macro Based On Changed Cell Address & Text

Apr 13, 2009

I have the following code pasted into the worksheet module which used to work fine but no longer does. I didn't touch the code, it just stopped working.


Private Sub WorkSheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$A$16"
Select Case Target
Case "Custom Color 1": Call CustomColorInput1
Case "Custom Color 2": Call CustomColorInput1
Case "Custom Color 3": Call CustomColorInput1
Case "Custom Color 4": Call CustomColorInput1
Case Else:
End Select
Case "$A$17"
Select Case Target
Case "Custom Color 1": Call CustomColorInput2
Case "Custom Color 2": Call CustomColorInput2
Case "Custom Color 3": Call CustomColorInput2
Case "Custom Color 4": Call CustomColorInput2
Case Else:
End Select
Case "$A$18"

CustomColorInput 1-6 are the same except they input data into different cells F16-F21.

When I attach any of the CustomColorInput macros to a button it works fine. When I try to call it from the worksheet module, the data input box pops up but the data doesn't get entered into the cell. When I try to step through the CustomColorInput macros using F8, the input box pops up, I enter data and press ok. Then I continue with F8 and the debugger jumps to a custom function that I entered (below), which is not called for and is in no way related to the code.

Function PullAfterLast(rCell As Range, strLast As String)
PullAfterLast = Mid(rCell, InStrRev(rCell, strLast) + 1, 256)
End Function

When I close VBA, the data that I typed into the data input box is in the correct cell.

So basically, I'm getting three different responses from the offending code depending on how I call it up. Can anyone tell me what's going on?

More generally, in this and previous occasions, I've had problems with macros that cease to work for no reason that is apparent to me. What are some things that would cause a macro to stop working, without actually changing the code (other than the obvious, like referring to names or worksheets etc. that don't exist anymore)?

View 9 Replies View Related

Automatically Fill In Column When Certain Cell In Column Changed

Jun 18, 2009

I am trying to have some automation to my WS and what I want to do, is if a certain column (column 104) is changed, it will fill out that column with the data entered as long as the account is the same (column 5). Here is the code I tried, but realized very quickly, it puts me into a loop. This is being called by a change worksheet fuction

If Target.Column = 104 Then
If IsEmpty(Target) Then
Else
testacct = Cells(Target.Row, 5)
temptest = testacct
s_TempSwitch = Target.Value
Testoffset = 0
Do While temptest = testacct
temptest = Cells(Target.Row + Testoffset, 5)
Cells(Target.Row + Testoffset, 104).Value = s_TempSwitch
Testoffset = Testoffset + 1
Loop
End If
End If

View 3 Replies View Related

Automatically Run Udf When Color Is Changed

May 2, 2007

I have a UDF that goes like this:

Function SumIfPurple(inputRange As Range, _
answerRange1 As Range, _
answerRange2 As Range) As Variant
Dim SumAnswer As Variant

'If inputRange is turned purple then it is equal to anserRange1, if it is left with no fill it is equal to answerrange2.

If inputRange.Interior.ColorIndex = 39 Then
SumAnswer = answerRange1.Value
Else
SumAnswer = answerRange2.Value
End If
SumIfPurple = SumAnswer
End Function

I would like to have a sub that will have the formula automatically calculate when the inputRange's color is changed.

View 6 Replies View Related

Run Macro Automatically Once 3 Cells Have Changed

May 21, 2008

how to alter this Private Sub for my code to execute automatically once all 3 cells have changed. At the moment it executes as soon as any of the 3 cells change.

Here's the Private and Public Sub codes:

View 9 Replies View Related

Update PowerPoint Automatically When SpreadSheet Is Changed

Apr 10, 2014

I'm trying to code so that any changes made to Excel document will automatically change in PowerPoint. I have Copied and Pasted Special link so that its connected but when ever a change is made in Excel in powerpoint I get a pop up box saying I need to press update. But I want to bypass the pop up update box and have it so that powerpoint automatically updates when I change something in Excel.

This is the code I have so far. I don't know if it's right or if I am on the right track as I get a compile error saying I need a End with.

[Code] .....

View 4 Replies View Related

Automatically Calculate The Bonus Points Into A Cell

Mar 29, 2006

I am updating a sports competition ladder. There are two aspects to compiling the table I would like to automate but have been unable to find out how via the excel documentation.

The aspects are.

1. When a team loses by a margin of seven points or less below the total points scored by the winning team then the team is awarded a single "1" bonus point that contributes to their overall competition points tally.
2. When a team scores four tries or more they are likewise awarded a bonus point.

I require formulas that will automatically calculate the bonus points into a cell.

Situation One
cell 1 = Points For (eg. 17)
Cell 2 = Points Against (eg. 24).
In this instance the team did not win. They scored 17 points and the winning team scored 24 points. Therefore the team lost but lost by seven points and is therefore entitled to one (1) bonus point.
SOLUTION NEEDED - I need a formula that will calculate whether cell 2 is seven or less than cell 1, and if so automatically place a total of "1" in cell 3.

Situation 2
Cell 1 = Tries Scored (eg. 5)
In this instance the team has scored five tries. They have scored more than four tries or more and is therefore entitled to one (1) bonus point.
SOLUTION NEEDED - I need a formula that will scan the number in cell 1. If this number is 4 or more, then a total of "1" should be automatically placed in Cell 2.

I have looked into the excel help but to no avail and the search terms are so broad it was a nightmare trying to search the forums.

View 11 Replies View Related

Excel 2013 :: All Sheets Being Automatically Changed To Currency Format

Dec 2, 2013

We have 3 PCs, all running MS Office 2013. On 1 of these machines, it is doing strange things with formatting. If you open a document or try to paste anything into certain documents, it decides everything is currency format and assigns all sorts of wrong formatting to the entire sheet, or the entire document. There may be some cells in the doc that are indeed currency, but only a small proprtion. If I open a new, fresh document and paste into that document, it does not do this, it seems to work normally, only applying currency formatting where it might be applicable. On some larger docs that have this issue, no matter what I do, it just continues to apply these strange settings.

View 2 Replies View Related

Worksheet Calculate Event To Automatically Change The Color Of A Cell

Jan 30, 2009

I am trying to use the worksheet calculate event to automatically change the color of a cell only when that particular cell changes. In E2 of the worksheet is a formula use to determine rating based on the result of 2 other cells. The rating is classified as follows

Low
Moderate
High
Maximum

I would like to generate a different set of color to the cell and fonts for each of the rating. For example,

"Cyan" to the cell E1 and E2 with Black font if the result is "Low"
"Plum" to the cell E1 and E2 with "Black font if the result is "Moderate"
"Blue" to the cell E1 and E2 with "White" font if the result is "High" and
"Red" to the cell E1 and E2 with "White" font if the result is "Maximum"

View 9 Replies View Related

Automatically Updating Adjacent Cells Based On Dropdown List Selection Even If Changed

Apr 12, 2013

I have a workbook that has two worksheets. One worksheet is an input worksheet. A user will select a date from a drop-down list and type in the events that occurred on that date in 8 adjacent cells. The user selects a button that advances date and clears form. On sheet 2, whatever was typed into sheet one is saved via VLOOKUP formula. However, if I try to change something retroactively and select a previous date from the drop-down list, it clears everything in sheet 2 that was typed for any selected day.

View 1 Replies View Related

Pivot Table Fields Expands Automatically When Updating Data (only Where Data Has Been Changed)

Jan 11, 2013

I have created a pivot table that is connected to an input sheet with data. The input sheet retrieves data automatically from a external source through an add-in to Excel. When updating data the fields expands, but only for the items which have been changed. I want the table to be updated automatically, but not the fields expand automatically. Is there any pivot options to prevent this problem?

It should be mentioned that the pivot table is not directly connected to the input sheet (which is updated from the external source), but from a "help-sheet" reflecting the input sheet with some additional columns. I use conditional formatting and name range in the pivot.

View 1 Replies View Related

Automatically Calculate The Percentage

Jun 14, 2007

code needed to be able to automatically calculate the percentage needed from one year to the next. I simply need it to automatically create a third column each time the copy old data button is pressed, and I need the column to have the percent increase ((current year - past year)/current year). Hopefully you can understand what I am aiming for. I have the current code below, and I will attach a compressed and stripped version of my workbook.

View 13 Replies View Related

How To Calculate AGE Automatically Using FUNCTIONS?

Nov 1, 2008

Hi to all. I am trying to calculate a list of person's age automatically using functions. Is that possible? I am using Microsoft Excel 2007. I try searcing the web and they say DATEDIF.... But i just can't find the function in Excel 2007!

View 7 Replies View Related

Automatically Calculate Date

Mar 14, 2008

I made to automatically calculating by date which is time formating want to count the stem hours, but it prompted error?

Sub UpdateColG()

Dim IRow As Long

For IRow = 3 To Range("F").End(xlUp).Row
Range("G" & IRow).Value = Range("F" & IRow).Value - Range("F" & IRow - 1).Value
Next
End Sub

===================================
the logical is Range (F2-F1) returns to (G2)
sample : (F2)10:30-(F1)09:45 =(G2)00:45.

View 9 Replies View Related

Conditional Formula And Calculate Automatically

Mar 1, 2009

I am creating a sales per day/week worksheet for my reps to keep track of their sales. I have created the sheet that they only have to enter in what they have sold and it automatically calculates what they have sold per hour in the day, and what that makes their weekly total.

The problem is sometimes they will work 5 days, sometimes 4, sometimes 6 or 7.

im trying to fix the weekly average formula to divide by 7.5 for 1 day worked, 15 for 2, 22.5 for 3, etc all through 7...

this is the formula I have now, obviously it doesnt work

=IF(COUNT(B7:H7)=1,SUM(E42,E75,E110,E143,E175,E207,E238)/7.5,IF(COUNT(B7:H7)=2,SUM(E42,E75,E110,E143,E175,E207,E238)/15,IF(COUNT(B7:H7)=3,SUM(E42,E75,E110,E143,E175,E207,E238)/22.5,IF(COUNT(B7:H7)=4,SUM(E42,E75,E110,E143,E175,E207,E238)/30,IF(COUNT(B7:H7)=5,SUM(E42,E75,E110,E143,E175,E207,E238)/37.5,IF(COUNT(B7:H7)=6,SUM(E42,E75,E110,E143,E175,E207,E238)/45,IF(COUNT(B7:H7)=7,SUM(E42,E75,E110,E143,E175,E207,E238)/52.5)))))))

View 7 Replies View Related

Stopping Formula To Automatically Calculate

Feb 20, 2009

Is there a way in which I can get excel not to run any formulas until I run some sort of command or click a button in order to tell it to?

For example, I have two sheets, one sheet has raw data entered manually into each cell, the other sheet has a large amount of formulas to calculate totals from this raw data. But every time a number is entered into a cell in the raw data sheet Excel says 'Calculating Cells', I want to be able to enter all my raw data, then go to my totals sheet and execute all my formulas.

View 5 Replies View Related

Automatically Calculate Date In The Future

Jul 25, 2007

I am trying to create a spreadsheet that will automatically calculate a date in the future.

The future date calculated needs to take the time NOW (as the user completes a field) and determines if this is before MIDNIGHT on the following SUNDAY. If so it calculates the date as a Tuesday 2 weeks on. For example... I request a date now on 1st Jan which is a Thursday. This is before midnight Sunday and so the date calculated would be Tuesday 20th January.

If the time NOW is after MIDNIGHT Sunday and before the next TUESDAY.. ie 0001hrs on the Monday and 2359hrs on the Monday then the date returned should be Tuesday 3 weeks on.. e.g 27th.

It would also need a function that would allow the total number of referrals on a Tuesday to 20 at which point it would overspill and provide a date on the Friday of the same week.. so in the first example it would be Friday 23rd

Is this something that can be achieved with formulas and a set of dates for it to calculate from or do I need to find someone who can do it in VBA for me.

View 9 Replies View Related

VBA If Cell Changed

Dec 30, 2009

If the value of any cell in in column D is changed to "Closed", a message box will appear that says "Others must be notified when item is closed". In that message box, I want two buttons: Button 1 One is cancel and will undo the change. Button 2 will open MS Outlook with pre-filled email addresses and will attach the open worksheet. After the email is sent, to return to Excel.

View 4 Replies View Related

Get The Value Of A Cell Before It Was Changed

Jul 26, 2007

I have the following code on my worksheet.

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("B2")) Is Nothing Then
Do_it
End If

End Sub

Cell B2 contains an employee number. What I need to do is save some data for the employee number that was in cell B2 just before it was changed.

Example: If employee number "10" is entered in B2.
Then the user were to change the employee number in cell B2 to "55" I would like to use the previous value "10" to do some VBA stuff with.

View 5 Replies View Related

Send Row Number Of Changed Cell To Cell Where Row Resides In Cell

Apr 26, 2008

I have the following range of cells B2:Y3700. I want that when a value from 1 to 9999 is inserted in one cell of the above mentioned range, to copy the row number of that cell in the cell that is located in column Z and row is the number inserted in that cell. For example, if the number "1234" is inserted in one cell from range B2:Y3700, to enter in cell Z1234 the number of the row where is located the respective cell. At same the time is very important to me to not permit to insert the same number in B2:Y3700, so i believe that is need a macro code to check the cell from column z to see if value already exist .

View 5 Replies View Related

VBA Code To Calculate Two Column Values Automatically

Aug 10, 2009

I have a simple script that puts the save time in the last row of column C when the spreadsheet is saved. Another script puts a username in Column A and column B contains the time opened. I would like to add to the save script to make column D od the active row have a calculation similar to:

View 2 Replies View Related

Monthly Depreciation Of An Asset To Automatically Calculate

Jan 25, 2010

I am working on a depreciation schedule in which I want the monthly depreciation of an asset to automatically calculate and, if the asset is fully depreciation, caclulate a zero or the balance to be depreciation (if less than the monthly depreciation). Please see below example. As you can see my asset is fully depreciated at the end of February but because there remains a $0.01, the formula is calculating another month in March and then reversing it in April (less the $0.01). Here's the formula I'm using. What am I doing wrong?

Column H is March, Column C is my monthly depreciation, and column E is my beginning book value:

=-IF(ABS(SUM($F2:H2))>=$E2,(SUM($F2:H2)+$E2),IF($E2=$C2,$C2,$E2)))

Purchase
PriceMonthly DepreciationAccumulated Depreciation 12/31/20091/1/2010 Beginning Book ValueJan-10Feb-10Mar-10Apr-10May-10
LCD PROJECTOR 797.12 13.29 (770.54) 26.58 (13.29) (13.29) (13.29) 13.28 -

View 9 Replies View Related

Automatically Calculate Based On CheckBox State

Jan 23, 2008

I have a Worksheet_Change event like the one below. When Checkbox1 is ticked the it subtracts and when it's not, it adds:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim intValue As Integer
If Not Intersect(Target, Range("W12:X24")) Is Nothing Then
intValue = CInt(Target.Value)
If CheckBox1.Value Then intValue = intValue * -1
Select Case Target
' Apples
Case Is = Range("W12")
Logbook.Show
Range("I10").Value = CInt(Range("I10").Value) + intValue
Case Is = Range("X12")........................

View 7 Replies View Related

Save When Cell Is Changed?

Jul 24, 2009

Is it possible to save a workbook whenever any changes are made to any cell in a specific column? The reason - I'm putting an excel workbook out on a network drive for 4-5people to share. The sheet contains work items which are imported every 4 hours... Column A contains the status.

I want to save the file every time anybody changes a status to prevent multiple users from working on the same item. I realize that I could build a form then load each workitem into the form, then apply the save to a change event on the field/control, but that's something for next week - I need to get this out the door, bare bones, as soon as possible.

View 2 Replies View Related

Insert A Date In A Cell When Another Cell's Number Has Been Changed

Dec 6, 2013

I am looking to insert a date in a Cell when another Cell's number has been changed.

I was using If statement as: If(isnumber(f4),TODAY())

but I don't think it is working properly

the cells columns would be, e.g. "Consumables stock" and "date updated".

So if someone changes a number is the "consumables stock" column, date updated column auto-updates with current date. How would I go by in doing this?

View 5 Replies View Related

Change Hyperlink As Cell Reference Is Changed In Cell?

Jan 27, 2012

Is it possible to change hyperlink as per the cell reference changed in a cell. for example :- in cell D2 the apply a match formula to find out a cell reference (eg "A"& Match function based on info type on cell A1) Now I want to create hyperlink as per the cell reference mentioned in cell D2. suppose I type Red in A1 and D2 give me the cell reference A51 than automatically Hyperlink create for A51. and it continiously changed whatever i type in A1 and what cell reference is showing in D2.

Sheet1ABCD1Type Abbrivation12Full FormACell AddressA13Is it possible that I click on Cell D2 and it goes to particular cell 45Abbrivation6Short CodeDescription71A82B93C104D115E126F137G148H159I1610J1711K1812L1913M2014N2115O2216P2317QExcel 2007Worksheet FormulasCellFormulaB2=VLOOKUP(B1,A6:$B$1000,2,0)D2="A"&MATCH(B1,$A$7:$A$1000,0)

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved