I have a report that I am working on. In the report one of the columns contains a number and I want to evaluate the last number and if it is not "5", I want to change it to "5".
Some Data:
[TABLE="width: 438"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]A_Siteid[/TD]
[TD]AB_Contractor Name[/TD]
[TD]AFF_A_PRCN[/TD]
[TD]AFF_B_RESOURCETYPE[/TD]
[/TR]
[TR]
[TD]BAR[/TD]
[TD]FLR ENTERPRISES[/TD]
[TD="align: center"]18891[/TD]
[TD]KLO[/TD]
[/TR]
[TR]
[TD]BAR[/TD]
[TD]FLR ENTERPRISES[/TD]
[TD="align: center"]19874[/TD]
[TD]KLO[/TD]
[/TR]
[TR]
[TD]BAR[/TD]
[TD]FLR ENTERPRISES[/TD]
[TD="align: center"]19871[/TD]
[TD]KLO[/TD]
[/TR]
[TR]
[TD]BAR[/TD]
[TD]FLR ENTERPRISES[/TD]
[TD="align: center"]18895[/TD]
[TD]KLO
[/TD]
[/TR]
</tbody>[/TABLE]
Most of my VBA for this spreadsheet is a loop that looks for values and makes the changes needed. The one to replace the Resource Type works fine, but I can't figure out how o look for the last digit in the PRCN.
Some Data:
[TABLE="width: 438"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]A_Siteid[/TD]
[TD]AB_Contractor Name[/TD]
[TD]AFF_A_PRCN[/TD]
[TD]AFF_B_RESOURCETYPE[/TD]
[/TR]
[TR]
[TD]BAR[/TD]
[TD]FLR ENTERPRISES[/TD]
[TD="align: center"]18891[/TD]
[TD]KLO[/TD]
[/TR]
[TR]
[TD]BAR[/TD]
[TD]FLR ENTERPRISES[/TD]
[TD="align: center"]19874[/TD]
[TD]KLO[/TD]
[/TR]
[TR]
[TD]BAR[/TD]
[TD]FLR ENTERPRISES[/TD]
[TD="align: center"]19871[/TD]
[TD]KLO[/TD]
[/TR]
[TR]
[TD]BAR[/TD]
[TD]FLR ENTERPRISES[/TD]
[TD="align: center"]18895[/TD]
[TD]KLO
[/TD]
[/TR]
</tbody>[/TABLE]
Most of my VBA for this spreadsheet is a loop that looks for values and makes the changes needed. The one to replace the Resource Type works fine, but I can't figure out how o look for the last digit in the PRCN.
Code:
'Change Resource Type to "KLO".
rowa = 3
Do Until Sheet11.Cells(rowa, 2).Value = Empty
If Sheet11.Cells(rowa, 4).Value <> "KLO" Then
Sheet11.Cells(rowa, 4).Value = "KLO"
End If
rowa = rowa + 1
Loop