Advice for approaching same goal but a different way

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Afternoon,
I am using the code below but have an issue with it so need to get advice to approach it from another angle.
Currently the code is in cell K33 BUT as soon as figures come into play on this cell the formula is gone.

Please advise how i can either put the code in another cell BUT have the figure still shown in cell K33 or advise.

Thanks


Rich (BB code):
=IF(D4="","",SUM('INCOME (2)'!G32 -'EXPENSES (3)'!K32)-MILEAGE!C32)
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Excel formulas can only return values to the cells that they exist in. They cannot return values to "other" cells.
To do something like what you want, may require VBA.

Why/how is the formula being overwritten?
How is the data being put into this sheet.

By the way, the SUM function is totally unnecessary in your formula. You use SUM to add up a whole range of cells, i.e.
=SUM(A1:Z1)
If you are manually typing in the "+" and "-" signs, there is no need for it.
Just use:
Excel Formula:
=IF(D4="","",'INCOME (2)'!G32 -'EXPENSES (3)'!K32 - MILEAGE!C32)
 
Upvote 0
Hi,
Values are copied from various cells on a worksheet.
When that sheet is full / complete a command button copies these values & then pastes then into various cells on the next worksheet.

This is when the formula that was in the cell gets removed & a value like say £1523.55 is then entered.
I assumed / liked it to have the formula & the £ value there but that is not the case here.

Example of copy / paste code

Rich (BB code):
Private Sub CommandButton1_Click()
  Sheets("EXPENSES (4)").Range("D4").Value = Sheets("EXPENSES (3)").Range("D30").Value
  Sheets("EXPENSES (4)").Range("F4:K4").Value = Sheets("EXPENSES (3)").Range("F30:K30").Value
  Sheets("EXPENSES (4)").Activate
  ActiveSheet.Range("A5").Select
  If Sheets("EXPENSES (4)").Range("K32").Value <> Sheets("EXPENSES (3)").Range("K32").Value Then MsgBox "Balance of sheets incorrect", vbCritical, "K32 CELLS DO NOT MATCH"
End Sub

Basically its just a running total of my income / expenses at a glance.
 
Upvote 0
You say this formula is in cell K33, and it is on the "EXPENSES (4)" sheet I presume?
I see nothing in your code that would be overwriting cell K33.
 
Upvote 0
Typo K32 but same for expenwses1,2,3 etc etc
Their still doesn't appear to be anything in that code that would be overwriting cell K32.
So I am very confused as to what is happening here, unless you have left some code or other important information off.
 
Upvote 0
Nope thats it.

I see the formula.
Values are copied from say EXPENSES 2 and pasted on worksheet EXPENSES 3 the cell where the formula was now shows example £123.45
Looking in address bar the formula is gone.

I moved the formula to another cell whilst wait for a reply & it works when i then do it.
Save then open & still there.

When i print though this cell is then outside of my print area.
So any reason as to why it dont like K32 ?

Thanks
 
Upvote 0
Values are copied from say EXPENSES 2 and pasted on worksheet EXPENSES 3 the cell where the formula was now shows example £123.45
There is nothing in your code that does that, so is that a step that you are doing manually?
If so, exactly what range are you copying over from EXPENSES 2 to EXPENSES 3?
And then is this "K32" cell with the formula you are talking about actually on EXPENSES 3 and not EXPENSES 4?
 
Upvote 0
The formula is on each expenses worksheet in cell K32

The code to copy / paste is as post # 3

Once thats been done formula in K32 is gone
 
Upvote 0
I think we are going to need to access a copy of this workbook to see what is going on.
Are you able to upload a copy, with any sensitive information removed, so that we can take a look at it for ourselves?
Simply upload it to a file sharing site and provide a link to it here.
 
Upvote 0

Forum statistics

Threads
1,214,947
Messages
6,122,413
Members
449,082
Latest member
tish101

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