View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Detect lines in specific sheet at load time

So just add this code to your import macro

Set rng = ActiveSheet.UsedRange
If rng(rng.Count).Row 10 Then
MsgBox "last row is " & rng(rng.Count).Row
End If


and also

Private Sub Workbook_Open()
Set rng = ActiveSheet.UsedRange
If rng(rng.Count).Row 10 Then
MsgBox "last row is " & rng(rng.Count).Row
End If

End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ladyhawke" wrote in message
oups.com...
Hi Bob
No they can't: The only occasion that inserts rows in that named sheet
is when the user imports data using a specific macro. This data is
sorted and if data is invalid for the current excel file the concerned
rows will be moved to the name sheet.

Therefore I would check whenever they perform the macro and let the
user know if the latest import had any "invalid" data and then just
remind them if needed (they didn't sort out the data) when opening the
excel file.

regards,
Ladyhawke


Bob Phillips wrote:
But with your method that could open the workbook, no problem, keep

putting
data beyond row 10 all day long, and not be told until they open it the

next
day.