Macro Disables Fixed Decimal Format


Posted by Julia on January 30, 2002 9:59 AM

I have a worksheet with columns Check ID, Amount and Description. The worksheet was set to "Fixed Decimal - 2 places" so when posting amounts I don't have to hit decimal (2575 = 27.75). I run a macro to allow me to enter data with the enter key and go to the next column so I can do everything with the number pad. The problem is that when running the macro, the amount does not keep the fixed decimal format (2575=2575). What can I do to correct this. It is a must that I do everything from the number pad. Here is the macro:
Sub enter_data()
newdata:
ActiveCell = InputBox("Check ID?", vbOKCancel)
ActiveCell.Offset(0, 1).Select
ActiveCell = InputBox("Amount?", vbOKCancel)
ActiveCell.Offset(0, 1).Select
ActiveCell = InputBox("Description?", vbOKCancel)
ActiveCell.Offset(1, -2).Select
ans = MsgBox("Next dataset. Continue?", vbOKCancel)
If ans = vbOK Then
GoTo newdata
Else: Exit Sub
End If
End Sub
Please Help Me

Posted by Larry on January 30, 2002 11:17 AM

************* An ugly solution, but try this for your input formula:

ActiveCell = Format(Val(InputBox("Check ID?", vbOKCancel) / 100), "#0.00")



Posted by Julia on January 30, 2002 11:41 AM

Thanks Larry, I think it's beautiful