Hey,
I’m having a little bit of difficultly with the following vba line. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o> </o>
If ActiveCell.Offset(0, -8) = 3 And ActiveCell.Offset(1, -8).Value = 2 Then<o></o>
<o> </o>
Basically, when I try and run the code I get a ‘Run-time error ‘13’, Type mismatch’ message/window pop-up and the code terminates. The reason is, at the start, the Activecell.Offset(1,-8).Value line is referring to a cell that contains a piece of text and not a number, however thereafter Activecell.Offset(1,-8).Value always refers to cell containing a number. I thought I could get around this by using an ‘On Error Resume Next’ but that doesn’t seem to work e.g.<o></o>
<o> </o>
If ActiveCell.Offset(0, -8) = 3 And ActiveCell.Offset(1, -8).Value = 2 Then<o></o>
<o> </o>
On Error Resume Next<o></o>
<o> </o>
I appreciate I could get round this using another If..Then statement, but I was hoping that there might be an easier way to get VBA to ignore the error. Any help or suggestions will be very appreciated.<o></o>
<o> </o>
Thanks in advance,
Lochnagar<o></o>
I’m having a little bit of difficultly with the following vba line. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o> </o>
If ActiveCell.Offset(0, -8) = 3 And ActiveCell.Offset(1, -8).Value = 2 Then<o></o>
<o> </o>
Basically, when I try and run the code I get a ‘Run-time error ‘13’, Type mismatch’ message/window pop-up and the code terminates. The reason is, at the start, the Activecell.Offset(1,-8).Value line is referring to a cell that contains a piece of text and not a number, however thereafter Activecell.Offset(1,-8).Value always refers to cell containing a number. I thought I could get around this by using an ‘On Error Resume Next’ but that doesn’t seem to work e.g.<o></o>
<o> </o>
If ActiveCell.Offset(0, -8) = 3 And ActiveCell.Offset(1, -8).Value = 2 Then<o></o>
<o> </o>
On Error Resume Next<o></o>
<o> </o>
I appreciate I could get round this using another If..Then statement, but I was hoping that there might be an easier way to get VBA to ignore the error. Any help or suggestions will be very appreciated.<o></o>
<o> </o>
Thanks in advance,
Lochnagar<o></o>