Excel VBA Macro

From: Mod_Inside (MODINSIDE) 1 Dec 2010 15:02
To: af (CAER) 6 of 9
I don't know how to show an error if the row returned is less than 85 or greater 85 in the sheet Main
From: af (CAER) 1 Dec 2010 15:12
To: Mod_Inside (MODINSIDE) 7 of 9
Oh, something like this should do it:
code:
If LastRow <> 85 Then
    PointlessVariable = MsgBox("Number of rows is not 85.", vbOKOnly, "YOU FAIL!")
End If

You could make it a bit more helpful by showing a different message depending on whether the number of rows is less than 85, or more.

edit:
Just in case you didn't know, '<>' means 'not equal to'. Sensible languages use '!=' or '!=='.
EDITED: 1 Dec 2010 15:13 by CAER
From: Queeg 500 (JESUSONEEZ) 1 Dec 2010 15:19
To: af (CAER) 8 of 9
See, knew there was a better way.

:'D

--
From: Mod_Inside (MODINSIDE) 1 Dec 2010 15:56
To: af (CAER) 9 of 9

Thanks Caer

 

Once i knew how it was supposed to be and a little tweak here and there it works a treat.

 

If i add a line it fails and if i take one away it fails. Brilliant thanks a lot