LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
Vsn Vsn is offline
external usenet poster
 
Posts: 21
Default Is Sheet Empty and unused

Thanks for all advices. Finaly I managed like this:-

Dim objActiveWkbk As Object
Dim objXL As Object

Set objXL = CreateObject("Excel.Application")
Set objActiveWkbk = objXL.Application.ActiveWorkbook

If objXL.Application.CountA(objActiveWkbk.ActiveSheet .usedrange) = 0 then
..........


Cheers,
Ludovic

"Rick Rothstein" schreef in bericht
...
I've not controlled Excel from another program before, so this is just a
guess... what about if you explicitly qualify the Cells property with
ActiveSheet property?

If Application.CountA(ActiveSheet.Cells) = 0 Then

--
Rick (MVP - Excel)


"Vsn" <vsn_hotmail_kom wrote in message
...
Unfortunatly I can't use this because i like to use the code from Access
VBA using late binding and that does not accept the 'Cells' in
'.CountA(Cells)'

Are there any other methods which would be suitable to be used from
Access. I like to check if there are any empty sheets in the workbook to
which i can dump data, this before I just add a sheet to the collection.

Cheers,
Ludovic

"Otto Moehrbach" schreef in bericht
...
Try this macro. HTH Otto
Sub IsSheetEmpty()
If Application.CountA(Cells) = 0 Then
MsgBox "It's empty."
Else
MsgBox "It's not empty."
End If
End Sub


"Vsn" <vsn_hotmail_kom wrote in message
...
Hi all,

I was thinking is there a methode in VBA to see if a sheet has been
used or that it is empty so that i can remove it from the workbook
knowing i do not loose data or better rename it an put the next bunch
of data comming?

Thx,
Ludovic






 
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
Copy Data from Sheet 1 to Empty Cell in Sheet 2 dtoland Excel Programming 2 November 4th 09 06:48 PM
Copy row to first empty row in new sheet Taylor Excel Programming 3 July 22nd 08 06:20 PM
Testing for empty sheet Stu W Excel Programming 2 July 4th 07 09:28 PM
Copy row with an empty cell for each row in a sheet [email protected] Excel Discussion (Misc queries) 2 April 24th 07 05:18 AM
Is there a way to cut off unused cells on a sheet newbie Excel Discussion (Misc queries) 2 August 3rd 05 06:13 PM


All times are GMT +1. The time now is 07:22 PM.

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"