Archive of Mr Excel Message Board
Sub Exercise()
Dim Exercise As Range
Dim CalorieBurn As Range
Dim TimeExercise As Range
Set Exercise = Application.InputBox _
(Prompt:="Select any exercise range", Title:="Exercise", Type:=8)
Set CalorieBurn = Range("c11")
Set TimeExercise = Range("c9")
Exercise.Select
If Range("a66").Value = "f" Or "F" Then
Exercise(Cells(2, 0)).Select
CalorieBurn.Value = TimeExercise.Value / 60 * ActiveCell
That is as far as I get and get a type mismatch but the value shows "f".
Thanks,
--robin t

| Check out our Excel VBA Resources | ||||
![]() |
![]() |
![]() |
![]() |
![]() |
Hi Robin
Try this
Option Compare Text
Sub Exercise()
Dim Exercise As Range
Dim CalorieBurn As Range
Dim TimeExercise As Range
Set Exercise = Application.InputBox _
(Prompt:="Select any exercise range", Title:="Exercise", Type:=8)
Set CalorieBurn = Range("c11")
Set TimeExercise = Range("c9")
Exercise.Select
If Range("a66").Value = "f" Or Range("a66").Value = "F" Then
Exercise(Cells(2, 0)).Select
CalorieBurn.Value = TimeExercise.Value / 60 * ActiveCell
That is as far as I get and get a type mismatch but the value shows "f".
Excel will not be case sensitive UNLESS you set the Option Compare to binary, the default is "Option Compare Text" (not case sensitive).
I have put the "Option Compare Text" at the top of the procedure just in case! So you can really remove the second IF.
Dave
OzGrid Business Applications
