Receiving mismatch type error


Posted by Faisal K on June 07, 2001 8:27 AM

The user inputs a scaling factor into a text box, which is then multiplied into a column of data. We tried the following code, but received an error "mismatch type". How do we convert txtScaleFactor.Value to a number? We think the problem is that it sees this as a string, instead of a number. Thanks.


'Now scaling desired range
For Each iCell In fCol.Cells
iCell.Value = (txtScaleFactor.Value) * (fCol.Offset(0, 1).Value)
Next



Posted by Barrie Davidson on June 07, 2001 8:59 AM

Try:
txtScaleFactor = CDbl(txtScaleFactor)
before your loop and change the syntax in your loop to:
iCell.Value = txtScaleFactor * (fCol.Offset(0, 1).Value)

Regards,
Barrie