Why does Excel add question marks to numeric values in a range? How to fix?

OaklandJim

Well-known Member
Joined
Nov 29, 2018
Messages
833
Office Version
  1. 365
Platform
  1. Windows
I am doing a super basic For Loop through a range of numeric values. I did do Format Cells => Number, no decimal points to make sure that the values are numbers. When I Debug.Print the numbers there are question marks after the numeric values. What might I check?

Here is a truncated version of my formula that causes the issue.

VBA Code:
Function DoTheForLoop(piQty As Long) As String
    
    Dim rAnchorCellCapacity As Range

    Dim rLookUpRange As Range
    
    Dim rCell As Range
   
    Dim iDataRows As Long
   
    Set rAnchorCellCapacity = [Data].Range("Header_Capacity")
    
    iDataRows = rAnchorCellCapacity.Offset(10000).End(xlUp).Row - rAnchorCellCapacity.Row
    
    Set rLookUpRange = rAnchorCellCapacity.Offset(1).Resize(iDataRows)
    
Debug.Print "rLookUpRange = " & rLookUpRange.Address
        
    For Each rCell In rLookUpRange

Debug.Print rCell.Value

    Next rCell
    
End Function

Debug.print output looks like this

rLookUpRange = $D$7:$D$11
36?
60?
72?
96?
120?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
After looking at values' TypeName I get string. I reentered the values and now they are Double. I suppose that the issue is fixed.
 
Upvote 0
Hello. The origin of the data: Is it a Web page?...
 
Upvote 0

Forum statistics

Threads
1,215,108
Messages
6,123,129
Members
449,097
Latest member
mlckr

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