Highlight cell when formula result changes

harbour1302

New Member
Joined
Jun 13, 2017
Messages
25
Hi Folks,

I have an ordering sheet for my business.

In cells F4:I4 i input my forecast sales.

In cells G8:I19 the result tells me how much stock to order.

I Place all orders on a Monday but have aproblem that if during the week i need to adjust my forecast, this changes the amount i need to order.

If possible i require a VBA that highlights any cell that result has changed and remove the highlight when sheet closes.

Or a VBA code that automatically creates a duplicate sheet with the actual numerical change in the cell, foe example if i require 2 boxes less then the duplicate sheet will show -2.

Thanks
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hey Guys,

This one has been allusive I am hoping one of the geniuses here can help.

I have an order calculator I developed for my business, I place all my orders Monday for the week, I am having an issue where if I should change my forecasted ales during the week the value of the amount ordered changes.

I would like a vba code to notice when a value has changed since last save and copy the entire sheet to a new workbook with the difference in values.

For example, if I originally needed to order 5 apples and the sales change I now need to order 7 apples; I would like a sheet to open with 2, in the apples row to show the difference I need to order. or -2 if I now require only 3 apples etc.

Is this even possible?

or does anyone have an alternative that would work, I have tried track changes but it doesn't work as all cells contain a formula.

Thanks so much!
 
Upvote 0
Hey Guys,

This one has been allusive I am hoping one of the geniuses here can help.

I have an order calculator I developed for my business, I place all my orders Monday for the week, I am having an issue where if I should change my forecasted ales during the week the value of the amount ordered changes.

I would like a vba code to notice when a value has changed since last save and copy the entire sheet to a new workbook with the difference in values.

For example, if I originally needed to order 5 apples and the sales change I now need to order 7 apples; I would like a sheet to open with 2, in the apples row to show the difference I need to order. or -2 if I now require only 3 apples etc.

Is this even possible?

or does anyone have an alternative that would work, I have tried track changes but it doesn't work as all cells contain a formula.

Thanks so much!
You might improve your chances of getting some help on this by posting your worksheet layout and formulas using one of the tools from the links below. One deterrent to answering a post like this is that you provide very little detail and no information that can easily be copied from a browser and pasted directly to Excel to use for testing a proposed solution.

Excel Jeanie link: Download
MrExcel HTML Maker link: http://www.mrexcel.com/forum/2545970-post2.html


 
Upvote 0
Hi,

I have included a portion of the spreadsheet i am using.

Excel Workbook
ABCEFGHI
1********
2********
3*Delivery Period**Mon, Tues & WedThurs & FriSat, Sun & MonTues & Wed
4*Sales Forecast (K)**8.2610.53
5********
6CodeProduct DescriptionPriceOn HandTransfer InWednesdayFridayMonday
7Chilled and Produce:
827874Cheese30.054.1*1.03.01.0
960124Hotdog78.241.0**1.0*
1011001Kepak Meat42.6018.9*4.016.05.0
1160122Bacon40.043.3**2.01.0
1275541Capsicum Green 70/90Mm8.991.1****
1375085Iceberg Lettuce Vacuum Cooled.5.403.5**3.0*
1475354Chilli Jalepeno Green.10.500.40.01.0*1.0
1575140Lemon Medium1.450.5****
1627865Mushrooms13.101.10.11.02.0*
1775697Onion Large13.102.4**1.01.0
1850994Five Guys Potatoes9.9023.1*4.019.06.0
1916073Tomato Large Round (G) *1-6Kg6.454.2*1.03.01.0
Order Calculator



Is this correct?

Thanks
 
Upvote 0
So in F4:I4 I add forecast sales this adjusts the order amount based on a usage calculated from another sheet.

I require a way to highlight changes if i adjust the forecast sales after orders are placed to make it easier to amend them.

either highlight the changed values and show old value when hover or duplicate sheet with changes only.

Any help would be awesome.

Thanks
 
Upvote 0
So in F4:I4 I add forecast sales this adjusts the order amount based on a usage calculated from another sheet.

I require a way to highlight changes if i adjust the forecast sales after orders are placed to make it easier to amend them.

either highlight the changed values and show old value when hover or duplicate sheet with changes only.

Any help would be awesome.

Thanks
You might consider a worksheet_change event module in the Calculator sheet that monitors F4:I4. Any change(s) to F4:I4 would trigger the event code which would need to include a way to determine if the change(s) is part of the initial sales forecast or a change to the initial forecast. If the former, the values in A3:I19 could be copied to a new sheet (the 'comparison' sheet) to set the "baseline" for the week. If the latter, a copy of the newly calculated A3:I19 values could be compared to the baseline and only the differences in F4:I4 and G8:I19 shown in a copy of the range A3:I19 pasted adjacent to the baseline values on the comparison sheet.
 
Upvote 0
Hi Joe,

I have looked on google and your reply.

I agree the best course would be to have a worksheet_change event that would copy all old values to a 'hiddensheet' whenever a change occurs in F4:I4.

I could then have a third sheet called 'amended orders' that would have a basic formula in each cell that is the value from the 'hiddensheet' (old value) - the new value form the 'order calculator'.

could anyone help with a code for this?

I have found this but can't seem to get it to work.

Private Sub Workbook_Open()

Dim hiddenSheet As Worksheet

Set hiddenSheet = Me.Worksheets.AddhiddenSheet.Visible = xlSheetVeryHidden
hiddenSheet.Name = "HiddenSheet"

Sheet2.UsedRange.Copy ThisWorkbook.Worksheets("HiddenSheet").Range(Sheet2.UsedRange.Address)

End Sub
 
Upvote 0
Hi Joe,

I have looked on google and your reply.

I agree the best course would be to have a worksheet_change event that would copy all old values to a 'hiddensheet' whenever a change occurs in F4:I4.

I could then have a third sheet called 'amended orders' that would have a basic formula in each cell that is the value from the 'hiddensheet' (old value) - the new value form the 'order calculator'.

could anyone help with a code for this?

I have found this but can't seem to get it to work.

Private Sub Workbook_Open()

Dim hiddenSheet As Worksheet

Set hiddenSheet = Me.Worksheets.AddhiddenSheet.Visible = xlSheetVeryHidden
hiddenSheet.Name = "HiddenSheet"

Sheet2.UsedRange.Copy ThisWorkbook.Worksheets("HiddenSheet").Range(Sheet2.UsedRange.Address)

End Sub
Someone here might be able to help you with this. It will require more time than I can afford to invest.
 
Upvote 0
This is the code i have managed to source;

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim OldVal As Variant, NewVal As Variant
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("MyRefRange")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Application.EnableEvents = False
NewVal = Target.Value
Application.Undo
OldVal = Target.Value
If IsNumeric(OldVal) And IsNumeric(NewVal) Then
' Copy Previous Values from F4:I4 to Sheet5
Sheet5.Cells(Target.Row, Target.Column).Value = OldVal
' Copy Previous Values from E8:I130 to Sheet5
Sheet2.Range("E8:I130").Copy
Sheet5.Range("E8").PasteSpecial (xlPasteValues)
Application.Goto Sheet5.Range("A1")
Application.CutCopyMode = xlCut
End If
Target.Value = NewVal
Application.Goto Sheet2.Cells(Target.Row, Target.Column)
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub


However it copies all data when changes are made in F4:I4

This can make the old data inaccurate as it recopies all cells rather than only the cells that have had a change in value.

Can anyone assist i need a way to have all cells monitored for change (including cells that change as a result of formula) and update the old values if they change.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top