Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

delete sheet help 2

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RANDY IN NC - 22 Mar 2006 22:38 GMT
Sorry about the last post... when I submited I got an error.. and
cannot figure out how to get it out of here..

So I will try again..

I have the following macro. The section that deletes empty sheets work
fine in another book as a standalone macro. but I cannot get it to wor
in this larger appliction.  What am I missing..

Thank you

Sub emailsubmit()
'
' emailsubmit Macro
' Macro recorded 03/22/2006 by Randy
'

'
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Sheets(Array("ORDER", "order2")).Select
Sheets("ORDER").Activate
Cells.Select
Selection.Copy
Workbooks.Add
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False

Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If Application.WorksheetFunction.CountA(sh.Cells) = 0 Then
sh.Delete
End If
Next

fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="excel Files (*.xls), *.xls")
If fileSaveName <> False Then
ActiveWorkbook.SaveAs fileSaveName
End If
Application.DisplayAlerts = False
Windows("orders for email.xls").Activate
ActiveWorkbook.Close
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Su
Don Guillett - 22 Mar 2006 22:53 GMT
try using the same for/next loop as with the delete. Also try to get rid of
your selections. And, try to not do ALL cells. Do only those needed by
finding the last row and column.

Signature

Don Guillett
SalesAid Software
dguillett1@austin.rr.com

>
> Sorry about the last post... when I submited I got an error.. and I
[quoted text clipped - 49 lines]
> Application.ScreenUpdating = True
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.