Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
QP1 QP1 is offline
external usenet poster
 
Posts: 1
Default update a sheet automatically with changing values from another she

Hello,

I would like to create a macro so that when I close my workbook, my "total
days" value and "total cost" value (which are in my "Cost Tracking Summary"
Sheet) are added to a new row of a table on a different worksheet, only if
the "Total Days" has changed. These values (Total Days and Total Cost) are
collated from other worksheets.

If anyone can assist me I would greatly appreicate it.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
Default update a sheet automatically with changing values from another she

I am assuming (probably incorrectly) that your Total Days is one cell located
at A2, if not, change it below on line total_days = ...

You should be able to copy this directly into you VB Editor.

Sub Auto_Close() 'For it to run after you close the workbook, the macro
needs to be called "Auto_Close"
Dim total_days As Integer 'Stores the number of total days for today
Dim this_sheet As Worksheet 'The current sheet you are on when you
start the macro

Set this_sheet = ActiveSheet

Sheets("Cost Tracking Summary").Select
total_days = Range("A2").Value 'Retrieve the number of total days from
cell A2

Range("A2:B2").Select 'Copy the contents of A2 (Total Days) and B2
(Total Cost)
Selection.Copy

Sheets("different worksheet").Select 'Move to the different worksheet
(need to change name to what the worksheet is really called)
Count = 1
While Len(Cells(Count, 1).Value) < 0 'Find the first unoccupied row in
column A
Count = Count + 1
Wend

If Cells(Count - 1, 1).Value < total_days Then 'If the last occupied
row in Column A does not contain the same value as today's total days, then
paste the values in the first unoccupied row
Range(Cells(Count, 1), Cells(Count, 1)).Select
ActiveSheet.Paste
Else
End If

this_sheet.Select 'Select the sheet the user was on before running the
macro
End Sub


Hope this helps, Jim

"QP1" wrote:

Hello,

I would like to create a macro so that when I close my workbook, my "total
days" value and "total cost" value (which are in my "Cost Tracking Summary"
Sheet) are added to a new row of a table on a different worksheet, only if
the "Total Days" has changed. These values (Total Days and Total Cost) are
collated from other worksheets.

If anyone can assist me I would greatly appreicate it.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Summary Sheet Automatically MarkT Excel Discussion (Misc queries) 7 December 18th 07 07:43 PM
How can I get data to automatically update using a master sheet? Julia Excel Worksheet Functions 0 July 30th 07 05:58 PM
how do I update a sheet automatically with the info from another? Richard New Users to Excel 3 April 21st 06 08:17 PM
Copying (Master) column to another sheet to automatically update LostInVirtualSpace Excel Worksheet Functions 0 September 19th 05 06:57 PM
How do I set my webpage to automatically update a changing spread. kluelessinky Excel Discussion (Misc queries) 0 February 10th 05 01:43 PM


All times are GMT +1. The time now is 06:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"