Excel VBA Macro

From: af (CAER) 1 Dec 2010 14:24
To: Mod_Inside (MODINSIDE) 3 of 9
This should get you the last row of the first column:
VBA code:
Dim LastRow As Integer
Set Lastow = Main.Range("A65536").End(xlUp).Row
EDITED: 1 Dec 2010 14:31 by CAER
From: Mod_Inside (MODINSIDE) 1 Dec 2010 14:25
To: af (CAER) 4 of 9

Thanks Caer

 

The problem is I dont know what to do with it once ive got it!

 

Any ideas would be really appreciated

From: af (CAER) 1 Dec 2010 14:31
To: Mod_Inside (MODINSIDE) 5 of 9
Do with what, the code or the value it results in?
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