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 / New Users / March 2007

Tip: Looking for answers? Try searching our database.

Key Board Shortcuts

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sree kasi - 28 Mar 2007 16:48 GMT
Hi,

I am new to Excel and VBA, I am looking for a keyboard shortcut to select
all worksheets in an excel workbook.

(Infact, i am planning to select all worksheets using a keeyboard shortcut
and then deselect the last worksheet, to delete all the selected worksheets.
I wish to use this, while i record a macro, to do this everytime i need to
update my file. Actually before running my macro, which would copy some
sheets from an open workbook, i need to delete these old sheets.)

Hoping for a reply and guidance soon,
Sincerely,
Sree
JE McGimpsey - 28 Mar 2007 17:11 GMT
One way, without deselecting:

   Public Sub DeleteAllButLastSheet()
       Dim i As Long
       With ActiveWorkbook.Worksheets
           If .Count > 1 Then
              For i = 1 To .Count - 1
                   .Item(i).Select Replace:=False
               Next i
               On Error Resume Next
               Application.DisplayAlerts = False
               ActiveWindow.SelectedSheets.Delete
               Application.DisplayAlerts = True
           End If
       End With
   End Sub

> Hi,
>
[quoted text clipped - 10 lines]
> Sincerely,
> Sree
sree kasi - 28 Mar 2007 18:14 GMT
That was super, it worked fine with my objective. Is it possible to record
that using a reader, or is it a real VB Program. Please let me know. I wish
to learn more.

> One way, without deselecting:
>
[quoted text clipped - 27 lines]
> > Sincerely,
> > Sree
JE McGimpsey - 29 Mar 2007 04:41 GMT
XL Macros are recorded as VBA commands, so there's really no difference
between macros and "real" VBA.

However, there are a lot of things that cannot be recorded, including
for...next loops and the .DisplayAlerts commands. I rarely use the
recorder any longer.

You can find out more about macros here:

   http://www.mvps.org/dmcritchie/excel/getstarted.htm

> That was super, it worked fine with my objective. Is it possible to record
> that using a reader, or is it a real VB Program. Please let me know. I wish
> to learn more.
sree kasi - 29 Mar 2007 09:38 GMT
Thank you very much for your help, i wish to be in touch.

> XL Macros are recorded as VBA commands, so there's really no difference
> between macros and "real" VBA.
[quoted text clipped - 10 lines]
> > that using a reader, or is it a real VB Program. Please let me know. I wish
> > to learn more.
 
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.