Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format problems with Combo Button 1

Status
Not open for further replies.

Lil8

Technical User
Oct 24, 2003
42
0
0
GB
Hi,

I have written VBA code in Excel that runs down a column
comparing the number in each cell with the value in a
combo button e.g.

Sheets("lookuporder").Range("A2").Activate

For Each Cell In Range("colOrderNo")
Dim OrderNo As Integer
OrderNo = cmbOrderNo.Value

' but the value selected in the above combo is read as a text character e.g. "3" so even if the Number in Cell is
the same as Number in Combo nothing will happen.I have tried formatting the Cells as Whole Number but get same poblem
If ActiveCell.Value <> OrderNo Then
ActiveCell.Offset(1, 0).Activate
If ActiveCell.Value = -1 Then
Exit For
End If
End If

Please can any on help
 
You could try

OrderNo = Val(cmbOrderNo.Value)

Or

OrderNo = Int(cmbOrderNo.Value)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top