#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Error 2015

Hi everybody,
I'm checking values thru a column but when it gets to #VALUE! is ignoring
the condition and setting the active cell to blue (index 8). Is there anyway
to catch this error and make the condition work?
Any help will be greatly appreciated

....part of code not working...

For i = 1 To LastRow
On Error Resume Next

If ActiveCell.Offset(0, 0).Value "0.895" And
ActiveCell.Offset(0, 0).Value < "1.1049" And _
Left(ActiveCell.Offset(0, -3).Value, 14) = "0.080 = QC STD"
Then
ActiveCell.Offset(0, 0).Interior.ColorIndex = 8

ElseIf (ActiveCell.Offset(0, 0).Value < "0.895" Or
ActiveCell.Offset(0, 0).Value "1.1049") And _
Left(ActiveCell.Offset(0, -3).Value, 14) = "0.080 = QC STD"
Then
ActiveCell.Offset(0, 0).Interior.ColorIndex = 44

'other conditions all working great

End If
ActiveCell.Offset(1, 0).Select
Next i
--
gaba :)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Error 2015

If iserror(activecell.value) then
activecell.Interior.ColorIndex = 33
else
if activecell.value 0.895 ....


(did you really want the double quotes around your numeric values?)



gaba wrote:

Hi everybody,
I'm checking values thru a column but when it gets to #VALUE! is ignoring
the condition and setting the active cell to blue (index 8). Is there anyway
to catch this error and make the condition work?
Any help will be greatly appreciated

...part of code not working...

For i = 1 To LastRow
On Error Resume Next

If ActiveCell.Offset(0, 0).Value "0.895" And
ActiveCell.Offset(0, 0).Value < "1.1049" And _
Left(ActiveCell.Offset(0, -3).Value, 14) = "0.080 = QC STD"
Then
ActiveCell.Offset(0, 0).Interior.ColorIndex = 8

ElseIf (ActiveCell.Offset(0, 0).Value < "0.895" Or
ActiveCell.Offset(0, 0).Value "1.1049") And _
Left(ActiveCell.Offset(0, -3).Value, 14) = "0.080 = QC STD"
Then
ActiveCell.Offset(0, 0).Interior.ColorIndex = 44

'other conditions all working great

End If
ActiveCell.Offset(1, 0).Select
Next i
--
gaba :)


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Error 2015

:)
David: Once again, thanks so much for your help. It's catching the error!
I've took the double quotes around the numeric values but it is not making
any difference... just looks better... Thanks!
Gaba

"Dave Peterson" wrote:

If iserror(activecell.value) then
activecell.Interior.ColorIndex = 33
else
if activecell.value 0.895 ....


(did you really want the double quotes around your numeric values?)



gaba wrote:

Hi everybody,
I'm checking values thru a column but when it gets to #VALUE! is ignoring
the condition and setting the active cell to blue (index 8). Is there anyway
to catch this error and make the condition work?
Any help will be greatly appreciated

...part of code not working...

For i = 1 To LastRow
On Error Resume Next

If ActiveCell.Offset(0, 0).Value "0.895" And
ActiveCell.Offset(0, 0).Value < "1.1049" And _
Left(ActiveCell.Offset(0, -3).Value, 14) = "0.080 = QC STD"
Then
ActiveCell.Offset(0, 0).Interior.ColorIndex = 8

ElseIf (ActiveCell.Offset(0, 0).Value < "0.895" Or
ActiveCell.Offset(0, 0).Value "1.1049") And _
Left(ActiveCell.Offset(0, -3).Value, 14) = "0.080 = QC STD"
Then
ActiveCell.Offset(0, 0).Interior.ColorIndex = 44

'other conditions all working great

End If
ActiveCell.Offset(1, 0).Select
Next i
--
gaba :)


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Error 2015

VBA is pretty forgiving in lots of things--but not always...so I try to be
careful (so I don't have to remember what VBA coerces and what it doesn't.)

gaba wrote:

:)
David: Once again, thanks so much for your help. It's catching the error!
I've took the double quotes around the numeric values but it is not making
any difference... just looks better... Thanks!
Gaba

"Dave Peterson" wrote:

If iserror(activecell.value) then
activecell.Interior.ColorIndex = 33
else
if activecell.value 0.895 ....


(did you really want the double quotes around your numeric values?)



gaba wrote:

Hi everybody,
I'm checking values thru a column but when it gets to #VALUE! is ignoring
the condition and setting the active cell to blue (index 8). Is there anyway
to catch this error and make the condition work?
Any help will be greatly appreciated

...part of code not working...

For i = 1 To LastRow
On Error Resume Next

If ActiveCell.Offset(0, 0).Value "0.895" And
ActiveCell.Offset(0, 0).Value < "1.1049" And _
Left(ActiveCell.Offset(0, -3).Value, 14) = "0.080 = QC STD"
Then
ActiveCell.Offset(0, 0).Interior.ColorIndex = 8

ElseIf (ActiveCell.Offset(0, 0).Value < "0.895" Or
ActiveCell.Offset(0, 0).Value "1.1049") And _
Left(ActiveCell.Offset(0, -3).Value, 14) = "0.080 = QC STD"
Then
ActiveCell.Offset(0, 0).Interior.ColorIndex = 44

'other conditions all working great

End If
ActiveCell.Offset(1, 0).Select
Next i
--
gaba :)


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Error 2015

Thanks Dave, another good lesson learnt today :)
I took all the quotes off and from now on I'll remember.

Gaba

"Dave Peterson" wrote:

VBA is pretty forgiving in lots of things--but not always...so I try to be
careful (so I don't have to remember what VBA coerces and what it doesn't.)

gaba wrote:

:)
David: Once again, thanks so much for your help. It's catching the error!
I've took the double quotes around the numeric values but it is not making
any difference... just looks better... Thanks!
Gaba

"Dave Peterson" wrote:

If iserror(activecell.value) then
activecell.Interior.ColorIndex = 33
else
if activecell.value 0.895 ....


(did you really want the double quotes around your numeric values?)



gaba wrote:

Hi everybody,
I'm checking values thru a column but when it gets to #VALUE! is ignoring
the condition and setting the active cell to blue (index 8). Is there anyway
to catch this error and make the condition work?
Any help will be greatly appreciated

...part of code not working...

For i = 1 To LastRow
On Error Resume Next

If ActiveCell.Offset(0, 0).Value "0.895" And
ActiveCell.Offset(0, 0).Value < "1.1049" And _
Left(ActiveCell.Offset(0, -3).Value, 14) = "0.080 = QC STD"
Then
ActiveCell.Offset(0, 0).Interior.ColorIndex = 8

ElseIf (ActiveCell.Offset(0, 0).Value < "0.895" Or
ActiveCell.Offset(0, 0).Value "1.1049") And _
Left(ActiveCell.Offset(0, -3).Value, 14) = "0.080 = QC STD"
Then
ActiveCell.Offset(0, 0).Interior.ColorIndex = 44

'other conditions all working great

End If
ActiveCell.Offset(1, 0).Select
Next i
--
gaba :)

--

Dave Peterson


--

Dave Peterson

Reply
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
why does excel 2007 subtract 2009 from 2015 = 1900? Penny32 Excel Worksheet Functions 7 May 11th 09 06:19 PM
Automation Error, Unknown Error. Error value - 440 Neo[_2_] Excel Programming 0 May 29th 04 05:26 AM
Error 2015 from ConvertFormula Gordon[_13_] Excel Programming 0 April 29th 04 02:48 AM
How to avoid error 2015 when using ActiveCell.Offsett in own function Torben Laursen Excel Programming 2 February 18th 04 03:53 PM


All times are GMT +1. The time now is 07:43 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"