VBA to update/reformat cells on summary sheet when another sheet changes

Drisso in Vegas

New Member
Joined
Aug 23, 2018
Messages
6
Hi there,
I have a workbook that tracks projects by project# (CIR). A button runs a VBA module for NewProjects that prompts for a new (unique number) CIR, copies and pastes a new row into the "Project Summary" sheet, and copies a project details sheet from a template sheet and names it as CIR. So there are multiple "CIR" sheets with the same certain fields that show on the one "Project Summary" sheet. This is done with =INDIRECT formulas in the copied rows of the "Project Summary" sheet like =INDIRECT("'"&$A2&"'!C1").
The problem comes when I update fields in the project details sheets that change from numbers to dates (or vise versa) because the "Project Summary" fields need to be reformatted to or from DATE. I need VBA to update (and reformat) cells in "Project Summary" when the corresponding cells in the "CIR" sheets are changed. It seems like it should be simple but I can't think of the best way ( Do While Loop to find cells by CIR in "Project Summary", Find function, Autofilter?). Can someone point me in the right direction? Thanks.

PROJECT SUMMARY
ABCDE
1CIRDUE DATE
TASK1TASK2TASK3
211111
1/15/20195/15/2018837/30/18
3222222/15/2019398/5/20188
4333333/1/2019408/1/20188/6/2018

<tbody>
</tbody>









11111 (PROJECT DETAILS)
ABCDEFGH
1CIR
11111

<tbody>
</tbody>
DATE SENTDAYS-PENDINGDATE-REC'D
2DUE DATE
1/15/2019

<tbody>
</tbody>
TASK15/1/18145/15/18
3TASK26/1/1883
4TASK37/5/18257/30/18

<tbody>
</tbody>

****** id="cke_pastebin" style="position: absolute; top: 399px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">
11111

<tbody>
</tbody>
</body>
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Ok so I came up with this Do Until Loop that gets "Project Summary" C2 updated when the date in "Project Details" F2 changes and places the number (14 from G2) in "Project Summary" C2 (sorry, I think the tables above are a little off).

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cir As String
Dim task1 As Integer
If Target.Address = "$F$2" Then
Cir = ActiveSheet.Range("C1").Value
task1 = ActiveSheet.Range("G2").Value
Worksheets("Project Summary").Activate
Worksheets("Project Summary").Range("A2").Select
Do Until ActiveCell.Value = Cir
ActiveCell.Offset(1, 0).Select
Loop
If Worksheets(Cir).Range("F2") = "" Then Exit Sub
ActiveCell.Offset(0, 2).Select
ActiveCell.NumberFormat = "0"
ActiveCell = task1
End If
End Sub



The problem now is "Project Summary" C2 only changes when "Project Details" F2 changes, but G2 has a formula =IF(F2,IF(H2,H2-F2,TODAY()-F2),0) that increments daily. When the workbook is opened the next day, G2 has incremented but C2 has not. Is there a different Event Procedure to make this happen? I'm getting the feeling I might have designed this backwards, by pushing the data from the "Project Details" sheets. Maybe the "Project Summary" sheet should be "pulling" the date from the other sheets? Thoughts? Thanks.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,862
Members
449,052
Latest member
Fuddy_Duddy

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