I have looked everywhere within my workbook/sheet for what could be causing the following code to enter its result rounded to the nearest dollar.
******************
Sub Office_Pay_Totals()
Dim i As Long
Dim j As Long
i = 0
ActiveSheet.Unprotect Password:="1"
Range("E31").Formula = "=Sumif(N9:N28,""x"",E9:E28)"
Let i = Range("e31")
For j = 9 To 28
ActiveSheet.Cells(j, 14).Activate
If ActiveSheet.Cells(j, 14) = "X" Then
ActiveSheet.Unprotect Password:="1"
ActiveSheet.Cells(j, 5).Activate
ActiveCell.BorderAround Weight:=xlMedium
ActiveSheet.Unprotect Password:="1"
ActiveSheet.Cells(j, 14).Clear
End If
Next j
On Error Resume Next
Let Range("e31") = i
On Error Resume Next
ActiveSheet.Protect Password:="1"
End Sub
*******************
Cell E31 has $0.00 formatting, but when ever I run this script the result is changed to $0 formatting. As a kicker, another PC (also WIN7) does not do this. Does anyone have ideas?
(The script looks in column N for any instances of "X", and if found adds all the corresponding row figures in column E and enters the total in cell E31)
And, yes, I'm a beginner.
******************
Sub Office_Pay_Totals()
Dim i As Long
Dim j As Long
i = 0
ActiveSheet.Unprotect Password:="1"
Range("E31").Formula = "=Sumif(N9:N28,""x"",E9:E28)"
Let i = Range("e31")
For j = 9 To 28
ActiveSheet.Cells(j, 14).Activate
If ActiveSheet.Cells(j, 14) = "X" Then
ActiveSheet.Unprotect Password:="1"
ActiveSheet.Cells(j, 5).Activate
ActiveCell.BorderAround Weight:=xlMedium
ActiveSheet.Unprotect Password:="1"
ActiveSheet.Cells(j, 14).Clear
End If
Next j
On Error Resume Next
Let Range("e31") = i
On Error Resume Next
ActiveSheet.Protect Password:="1"
End Sub
*******************
Cell E31 has $0.00 formatting, but when ever I run this script the result is changed to $0 formatting. As a kicker, another PC (also WIN7) does not do this. Does anyone have ideas?
(The script looks in column N for any instances of "X", and if found adds all the corresponding row figures in column E and enters the total in cell E31)
And, yes, I'm a beginner.