Hello all,
I have an odd scenario that has just happened to me for the first time with an existing file and macro I have used for some time now. This code was compiled over some versions of the file, but I am not able to reason out this piece and what it is resulting as.
Okay, here is my data below from my RLws tab:
[TABLE="class: outer_border, width: 500, align: center"]
<tbody>[TR]
[TD]Role Description for SOW[/TD]
[TD]Total Hours[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]8.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]8.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]4.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]20.0[/TD]
[/TR]
[TR]
[TD]WIM Consultant[/TD]
[TD]26.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]24.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]4.0[/TD]
[/TR]
[TR]
[TD]WIM Consultant[/TD]
[TD]16.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]8.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]40.0[/TD]
[/TR]
[TR]
[TD]Practice Director[/TD]
[TD]20.0[/TD]
[/TR]
</tbody>[/TABLE]
And here is my VBA code to summarize this data...among some other actions, but the summary is my issue:
'Copy RL worksheet values to the Financial Summary Worksheet
'Begin Change
For Each resource In RLws.Range("B5:B" & LCell)
ResourceRow = resource.Row
NextRow = Fws.Cells(Fws.Rows.Count, "A").End(xlUp).Row + 1
RoleDescription = RLws.Range("B" & ResourceRow).Value
RoleDescription = RLws.Range("B" & ResourceRow).Value
If (RoleDescription Like "*Project*") Then
RoleDescription = "Project Management"
End If
Set ExistingService = Fws.Range("A9:A" & NextRow).Cells.Find(RoleDescription)
Set ExistingService = Fws.Range("A5:A" & NextRow).Cells.Find(RoleDescription)
If (ExistingService Is Nothing) Then
Fws.Range("A" & NextRow) = RoleDescription
Fws.Range("A" & NextRow).VerticalAlignment = xlCenter
Else
NextRow = ExistingService.Row
End If
Fws.Range("B" & NextRow).Value = Format(Fws.Range("B" & NextRow).Value + RLws.Range("DG" & ResourceRow).Value, "#,##0")
Next resource
'End Change
But, here is the catch, the following is the summation, which is incorrect. I believe my 'RoleDescription' is combining incorrect roles and resulting in bad data:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Services[/TD]
[TD]Hours[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]40[/TD]
[/TR]
[TR]
[TD]WIM Consultant[/TD]
[TD]118[/TD]
[/TR]
[TR]
[TD]Practice Director[/TD]
[TD]20[/TD]
[/TR]
</tbody>[/TABLE]
The above VBA summary is incorrect as it should be:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Services[/TD]
[TD]Hours[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]116[/TD]
[/TR]
[TR]
[TD]WIM Consultant[/TD]
[TD]42[/TD]
[/TR]
[TR]
[TD]Practice Director[/TD]
[TD]20[/TD]
[/TR]
</tbody>[/TABLE]
CAN ANYBODY SEE WHAT I HAVE GOING ON INCORRECTLY HERE THAT MY MACRO IS RE SUMMARIZING ROLES(ALBEIT SIMILAR ONES) AND APPLYING INCORRECT HOUR AMOUNTS ???
Thank you much!
Matt
I have an odd scenario that has just happened to me for the first time with an existing file and macro I have used for some time now. This code was compiled over some versions of the file, but I am not able to reason out this piece and what it is resulting as.
Okay, here is my data below from my RLws tab:
[TABLE="class: outer_border, width: 500, align: center"]
<tbody>[TR]
[TD]Role Description for SOW[/TD]
[TD]Total Hours[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]8.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]8.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]4.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]20.0[/TD]
[/TR]
[TR]
[TD]WIM Consultant[/TD]
[TD]26.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]24.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]4.0[/TD]
[/TR]
[TR]
[TD]WIM Consultant[/TD]
[TD]16.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]8.0[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]40.0[/TD]
[/TR]
[TR]
[TD]Practice Director[/TD]
[TD]20.0[/TD]
[/TR]
</tbody>[/TABLE]
And here is my VBA code to summarize this data...among some other actions, but the summary is my issue:
'Copy RL worksheet values to the Financial Summary Worksheet
'Begin Change
For Each resource In RLws.Range("B5:B" & LCell)
ResourceRow = resource.Row
NextRow = Fws.Cells(Fws.Rows.Count, "A").End(xlUp).Row + 1
RoleDescription = RLws.Range("B" & ResourceRow).Value
RoleDescription = RLws.Range("B" & ResourceRow).Value
If (RoleDescription Like "*Project*") Then
RoleDescription = "Project Management"
End If
Set ExistingService = Fws.Range("A9:A" & NextRow).Cells.Find(RoleDescription)
Set ExistingService = Fws.Range("A5:A" & NextRow).Cells.Find(RoleDescription)
If (ExistingService Is Nothing) Then
Fws.Range("A" & NextRow) = RoleDescription
Fws.Range("A" & NextRow).VerticalAlignment = xlCenter
Else
NextRow = ExistingService.Row
End If
Fws.Range("B" & NextRow).Value = Format(Fws.Range("B" & NextRow).Value + RLws.Range("DG" & ResourceRow).Value, "#,##0")
Next resource
'End Change
But, here is the catch, the following is the summation, which is incorrect. I believe my 'RoleDescription' is combining incorrect roles and resulting in bad data:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Services[/TD]
[TD]Hours[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]40[/TD]
[/TR]
[TR]
[TD]WIM Consultant[/TD]
[TD]118[/TD]
[/TR]
[TR]
[TD]Practice Director[/TD]
[TD]20[/TD]
[/TR]
</tbody>[/TABLE]
The above VBA summary is incorrect as it should be:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Services[/TD]
[TD]Hours[/TD]
[/TR]
[TR]
[TD]Consultant[/TD]
[TD]116[/TD]
[/TR]
[TR]
[TD]WIM Consultant[/TD]
[TD]42[/TD]
[/TR]
[TR]
[TD]Practice Director[/TD]
[TD]20[/TD]
[/TR]
</tbody>[/TABLE]
CAN ANYBODY SEE WHAT I HAVE GOING ON INCORRECTLY HERE THAT MY MACRO IS RE SUMMARIZING ROLES(ALBEIT SIMILAR ONES) AND APPLYING INCORRECT HOUR AMOUNTS ???
Thank you much!
Matt