View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] mlthornton@gmail.com is offline
external usenet poster
 
Posts: 13
Default Optional argument as Variant not acting like number

Very helpful.

I removed the "On Error Resume Next" statement as it was apparently masking the mistakes. Where I believe the code is failing is the line:

"If Mid(ProductCell.Offset(0, 1).Value, 4, 1) * 1 = ShiftNum * 1 Then"

The Mid statement (with or without the " * 1 "), never equals ShiftNum. Even substituting ShiftNum with a number (1, 2, or 3) that I knew 'should' yield True in some cases, still failed to advance past that statement.

So I think my question is: is there a better method than Mid to find the nth number in a string of numbers and return that value as a number?

Thanks for the very helpful response!