Getting Debug on VBA from cells format?

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,129
Office Version
  1. 365
Platform
  1. Windows
Hi I get a break down below. What I do is some matching if values match.

On a normal sheet it works fine with the numbers, but I am trying to run it off of numbers that formulas are pulling in.

The thing is im not sure if the break is telling me this or its the cell formats


Code:
Sub Run()   
    Dim myFndCll As Range
    Dim myNumID As String
    Dim myAmount As Double
    Dim lrow As Long
    lrow = Cells(Rows.count, "A").End(xlUp).Row
    
    For LngLp = 2 To lrow
    myNumID = Cells(LngLp, "A") 'Get New Value
  [COLOR=#b22222]  myAmount = Cells(LngLp, "A").Offset(, 1)  <------Breaks here[/COLOR]
    
    Set myFndCll = Columns(3).Find(What:=myNumID, _
                    LookIn:=xlValues, _
                    LookAt:=xlWhole)
                    
    If myFndCll Is Nothing Then
       'Value doesn't exist in column C so highlight value in column A
          Cells(LngLp, "A").Interior.ColorIndex = 4
    Else
        If myAmount <> myFndCll.Offset(, 1) Then
            myFndCll.Offset(, 1).Interior.ColorIndex = 6
            Cells(LngLp, "A").Offset(, 1).Interior.ColorIndex = 6
        End If
    End If
    Next LngLp

End Sub
 
Sorry if it retunrs something different then 0. Is there a way to fix that cell or cells without interuppting anything inside it like a formula or a number
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
It depends on what it is. If it is a space, you could select the whole column and do a Foind/Replace replacing a single space with nothing.
If it is something else, you will probably need to identify exactly what that is before determining how to correct it.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top