Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50070

[SOLVED] Passing Variable through (radio) OptionButton(s) [Excel 2010/14 VBA Only)

$
0
0
I am having trouble with code contained in the attached sheet. It works fine for this but when I integrated it into another sheet it isn't working. I need to pass the selection from the OptionButton(s) to use in the following code.

Code:

           
            valid = False
            Do Until valid = True
            drg = Application.InputBox(prompt:="Enter the DRG", Title:="DRG", Left:=300, Top:=250, Type:=1)
            If drg <> Empty And drg <> "False" Then
                    valid = True
            End If
            Loop
           
            Select Case disch_date
                Case 39722 To 39993
                    Set drgFound = drg_range.Find(drg, , , xlWhole)
                    If drgFound Is Nothing Then
                        cwDRG = Application.VLookup(drg, cw_Range, 2, False)
                        cwDRG_descrip = Application.VLookup(cwDRG, drg_range, 2, False)
                        cwBln = True
                    Else
                        Set msdrgFound = msdrg_range.Find(drg, , , xlWhole)
                        If msdrgFound Is Nothing Then
                            cwDRG = drg
                            cwDRG_descrip = Application.VLookup(drg, drg_range, 2, False)
                            cwBln = False
                        Else
                            msdrg = drg
                            msdrg_descrip = Application.VLookup(msdrg, msdrg_range, 2, False)
                            drg_descrip = Application.VLookup(drg, drg_range, 2, False)
                       
                            Set drg_select = New drg_select
                            With drg_select
                                .Show
                            End With
                        End If
                    End If
                   
                    Select Case cwBln
                        Case True
                        MsgBox ("Crosswalked MS-DRG is: " & cwDRG & "." _
                        & vbCrLf & cwDRG_descrip)
                       
                        Case False
                        MsgBox ("DRG is: " & cwDRG & "." _
                        & vbCrLf & cwDRG_descrip)
                    End Select
                   
                    drg = cwDRG
                   
                Case Else
            End Select

inp_form.Range("F14").Value = drg
            If trauma = "YES" And admit_type = "5" Then
                'set trauma dynamic DRG range
                Set arrayrange = ActiveWorkbook.Sheets("ARRAYS").Range("A1:E" & ActiveWorkbook.Sheets("ARRAYS").Cells(Rows.Count, "A").End(xlUp).Row + 1)
                services = "TRAUMA"
                conc = dyear & services & geozip
                lkuprange = Application.VLookup(conc, arrayrange, 5, False)
                Set trange = ActiveWorkbook.Sheets("08FSDATA").Range(lkuprange)
              drg_value = Application.VLookup(drg, trange, 3, False)
                drg_descrip = Application.VLookup(drg, trange, 2, False)
               
inp_form.Range("E15").Value = drg_descrip
            Else
                'set standard dynamic DRG range
                Set arrayrange = ActiveWorkbook.Sheets("ARRAYS").Range("A1:E" & ActiveWorkbook.Sheets("ARRAYS").Cells(Rows.Count, "A").End(xlUp).Row + 1)
                services = "STANDARD"
                conc = dyear & services & geozip
                lkuprange = Application.VLookup(conc, arrayrange, 5, False)
                Set trange = ActiveWorkbook.Sheets("08FSDATA").Range(lkuprange)
               drg_value = Application.VLookup(drg, trange, 3, False)
                drg_descrip = Application.VLookup(drg, trange, 2, False)
               
inp_form.Range("E15").Value = drg_descrip
            End If

Attached Files

Viewing all articles
Browse latest Browse all 50070

Trending Articles