Mally,
I am trying to streamline the code from:
BillScreenPrint:
Set inp_form = ActiveWorkbook.Worksheets("TEST")
Rows("13:" & (iCountBox + 13)).Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
For i = 1 To iCountBox
cntrng = 12 + i
inp_form.Range("A" & cntrng).Value = i
inp_form.Range("A" & cntrng).NumberFormat = "0"
inp_form.Range("A" & cntrng).HorizontalAlignment = xlCenter
inp_form.Range("B" & cntrng).Value = revcode(i)
inp_form.Range("B" & cntrng).NumberFormat = "000"
inp_form.Range("B" & cntrng).HorizontalAlignment = xlCenter
inp_form.Range("D" & cntrng).Value = hcpc(i)
inp_form.Range("D" & cntrng).NumberFormat = "00000"
inp_form.Range("D" & cntrng).HorizontalAlignment = xlCenter
inp_form.Range("E" & cntrng).Value = modifier(i)
inp_form.Range("E" & cntrng).HorizontalAlignment = xlCenter
inp_form.Range("F" & cntrng).Value = iDate(i)
inp_form.Range("F" & cntrng).NumberFormat = "mm/dd/yy;@"
inp_form.Range("F" & cntrng).HorizontalAlignment = xlCenter
inp_form.Range("G" & cntrng).Value = unit(i)
inp_form.Range("G" & cntrng).NumberFormat = "0"
inp_form.Range("G" & cntrng).HorizontalAlignment = xlCenter
inp_form.Range("H" & cntrng).Value = charges(i)
inp_form.Range("H" & cntrng).NumberFormat = "$#,##0.00_);($#,##0.00)"
inp_form.Range("H" & cntrng).HorizontalAlignment = xlRight
Next
GoTo ErrorCheck
to something within a line or four. I know it can be done, but I don't understand the code. I am too new to this.
As far as error correction goes, the bill is printed onto the screen (using the above code) and then:
ErrorCheck:
Response = MsgBox("Is the bill correct?", vbYesNo)
Select Case Response
Case vbYes
MsgBox "Congrats"
GoTo Calculations
Case vbNo
GoTo CorrectErrors
End Select
CorrectErrors:
iLineItem = InputBox("Enter Line Item You Need to Correct?")
x = iLineItem
valid = False
Do Until valid = True
revcode(x) = Application.InputBox(prompt:="Enter Rev Code for Line Item #" & x, Title:="Rev Code for Line Item #" & x, Left:=300, Top:=250, Type:=1)
If revcode(x) <> Empty And revcode(x) <> "False" Then
valid = True
End If
Loop
valid = False
Do Until valid = True
hcpc(x) = Application.InputBox(prompt:="Enter HCPC/CPT Code for Line Item #" & x, Title:="HCPC/CPT Code for Line Item #" & x, Left:=300, Top:=250, Type:=1)
If hcpc(x) <> Empty And hcpc(x) <> "False" Then
valid = True
End If
Loop
modifier(x) = Application.InputBox(prompt:="Enter Modifier for Line Item #" & x, Title:="Modifier for Line Item #" & x, Left:=300, Top:=250, Type:=2)
valid = False
Do Until valid = True
iDate(x) = Application.InputBox(prompt:="Enter Date of Service for Line Item #" & x, Title:="Date for Line Item #" & x, Left:=300, Top:=250, Type:=2)
If iDate(x) <> Empty And iDate(x) <> "False" Then
valid = True
End If
Loop
valid = False
Do Until valid = True
unit(x) = Application.InputBox(prompt:="Enter Number of Service Units for Line Item #" & x, Title:="Units for Line Item #" & x, Left:=300, Top:=250, Type:=1)
If unit(x) <> Empty And unit(x) <> "False" Then
valid = True
End If
Loop
valid = False
Do Until valid = True
charges(x) = Application.InputBox(prompt:="Enter Charges for Line Item #" & x, Title:="Charges for Line Item #" & x, Left:=300, Top:=250, Type:=1)
If charges(x) <> Empty And charges(x) <> "False" Then
valid = True
End If
Loop
It allows them to identify where the error is and correct the whole line.
Bookmarks