LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default confused as to why macro is not working correctly

Hello,

I am now quite confused as to why this sub macro keeps on declaring some
cell values to be exceeding 30. Basically I was given a bunch of
spreadsheets that computes mileage (and a few other variables) and
another spreadsheet that reads them in and creates a data file to be
imported into another system.

The macro I have written (and works elsewhere, please ignore the linewrap)
==================================
Sub CheckMiles(sheetCurrent As Worksheet)
'checks mode for more than 30 miles in a stop.
Dim bCell As Range
Dim bMax As Integer
Dim bMessageBox As String
bMax = 30
For Each bCell In sheetCurrent.Range("O17:O46")
If bCell.Value bMax Then
bMessageBox = MsgBox("More than " & bMax & " in a mileage
count on " & sheetCurrent.Parent.Name & ".")
End If
Next bCell
End Sub
================================

It works if for example a computed value of say, O20 is 10.45678, but it
puts out the messagebox incorrectly if O20 is 4.1234567890.

Any ideas?

Thanks!

Amanda
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro not working correctly Andy_N1708 via OfficeKB.com Excel Discussion (Misc queries) 3 May 27th 10 03:35 AM
Formula not working and I am extremely confused scott Excel Worksheet Functions 2 August 29th 08 07:20 PM
Formulas not working correctly Curt D. Excel Worksheet Functions 6 November 1st 07 08:48 PM
SUM formula not working correctly Kim Excel Worksheet Functions 1 November 1st 07 03:45 PM
VBE Window not working correctly STEVE BELL Excel Programming 6 June 10th 05 05:36 PM


All times are GMT +1. The time now is 11:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"