+ Reply to Thread
Results 1 to 2 of 2

Range Find is Empty [Excel 14/2010] (VBA Only)

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-22-2012
    Location
    OR, USA
    MS-Off Ver
    Excel 14/2010
    Posts
    273

    Range Find is Empty [Excel 14/2010] (VBA Only)

    I have used code similar to below but for some reason its not working this time. I compared the code, nothing is different. The dim are all the same.
    HOwever, while the "dataFound" is getting a range the "allowance" and "iDescrip" are coming up as empty.


        Dim dataSheet As String, iDRG As Variant, iDescrip As Variant
        Dim allowance As Variant, dataFound As Range
        Dim dataRange As Range, billedCharges As String, adjustedCharges As String
        Dim rev278 As String, notOulier As Boolean, outlierPercent As String
        Dim outlierCharge As Double, outlierPayment As Double
        
        Set inp_form = ActiveWorkbook.Sheets("INPATIENT")
        iDRG = inp_form.Range("C12").Value
        billedCharges = inp_form.Range("C7").Value
        rev278 = inp_form.Range("C18").Value
        adjustedCharges = billedCharges - rev278
        
        dataSheet = "MS-DRG"
        Set dataRange = ActiveWorkbook.Sheets(dataSheet).Range("A1:C" & ActiveWorkbook.Sheets(dataSheet).Cells(Rows.Count, "A").End(xlUp).Row + 1)
        Set dataFound = dataRange.Find(iDRG, , , , xlWhole)
        If dataFound Is Nothing Then
            allowance = adjustedCharges * 0.6223
            iDescrip = "MS-DRG NOT FOUND IN GEORGIA FEE SCHEDULE."
            inp_form.Range("B14").Value = iDescrip
            inp_form.Range("F14").Value = allowance
            notOutlier = True
        Else
            allowance = dataFound.Offset(, 2).Value
            iDescrip = dataFound.Offset(, 1).Value
            inp_form.Range("B14").Value = iDescrip
            inp_form.Range("F14").Value = allowance
        End If
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-22-2012
    Location
    OR, USA
    MS-Off Ver
    Excel 14/2010
    Posts
    273

    Re: Range Find is Empty [Excel 14/2010] (VBA Only)

    Had 1 too many commas. Corrected code line is as follows:

        Set dataFound = dataRange.Find(iDRG, , , xlWhole)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1