Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DEE DEE is offline
external usenet poster
 
Posts: 250
Default HELP! Sh as Worksheet

Hi,

I'm a newbie and as having trouble grasping something. I'm running code to
delete all empty sheets in a workbook. The code I have found begins with
Dim sh as Worksheets
For Each sh in ThisWorkbook.Worksheets
If Application.WorksheetFunction.Counta(sh.cells) = 0 Then
application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts=True
End if
Next

My questions is:

What does the sh as Worksheet mean in plain English?
I assume the Displayalerts means don't show me the confirmation message to
delete sheets

Thanks!

--
Thanks!

Dee
  #2   Report Post  
Posted to microsoft.public.excel.programming
job job is offline
external usenet poster
 
Posts: 65
Default HELP! Sh as Worksheet

Hi,

You are assigning a variable for referencing the sheets in the workbook.
You could just as easily say;

For each sht in ThisWorkbook.Worksheets. You can assign whatever you would
like. Think of it as a quick way to reference the sheets. Look up
variables in the help file.

Yes, the display alerts does what you think it does.

HTH,

Job

"dee" wrote in message
...
Hi,

I'm a newbie and as having trouble grasping something. I'm running code
to
delete all empty sheets in a workbook. The code I have found begins with
Dim sh as Worksheets
For Each sh in ThisWorkbook.Worksheets
If Application.WorksheetFunction.Counta(sh.cells) = 0 Then
application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts=True
End if
Next

My questions is:

What does the sh as Worksheet mean in plain English?
I assume the Displayalerts means don't show me the confirmation message to
delete sheets

Thanks!

--
Thanks!

Dee



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default HELP! Sh as Worksheet

It means you are telling vba you are going to use a variable named Sh in the
code which is of type Worksheet
For the DisplayAlerts, you' re right.

Sebastien

"dee" wrote:

Hi,

I'm a newbie and as having trouble grasping something. I'm running code to
delete all empty sheets in a workbook. The code I have found begins with
Dim sh as Worksheets
For Each sh in ThisWorkbook.Worksheets
If Application.WorksheetFunction.Counta(sh.cells) = 0 Then
application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts=True
End if
Next

My questions is:

What does the sh as Worksheet mean in plain English?
I assume the Displayalerts means don't show me the confirmation message to
delete sheets

Thanks!

--
Thanks!

Dee

  #4   Report Post  
Posted to microsoft.public.excel.programming
DEE DEE is offline
external usenet poster
 
Posts: 250
Default HELP! Sh as Worksheet

Hi,

Thank you both for your responses.

I guess I don`'t understand why I can't refer to the worksheet objects
directly. In other words, why do I have to assign a variable?

I guess I need lots of work in this area to understand it clearly, but with
the valuable help from people like you, I will eventually get it!

Thanks!



"Job" wrote:

Hi,

You are assigning a variable for referencing the sheets in the workbook.
You could just as easily say;

For each sht in ThisWorkbook.Worksheets. You can assign whatever you would
like. Think of it as a quick way to reference the sheets. Look up
variables in the help file.

Yes, the display alerts does what you think it does.

HTH,

Job

"dee" wrote in message
...
Hi,

I'm a newbie and as having trouble grasping something. I'm running code
to
delete all empty sheets in a workbook. The code I have found begins with
Dim sh as Worksheets
For Each sh in ThisWorkbook.Worksheets
If Application.WorksheetFunction.Counta(sh.cells) = 0 Then
application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts=True
End if
Next

My questions is:

What does the sh as Worksheet mean in plain English?
I assume the Displayalerts means don't show me the confirmation message to
delete sheets

Thanks!

--
Thanks!

Dee




  #5   Report Post  
Posted to microsoft.public.excel.programming
DEE DEE is offline
external usenet poster
 
Posts: 250
Default HELP! Sh as Worksheet

Thanks! I think I got it!
Thanks to you both!

"Job" wrote:

Hi,

You are assigning a variable for referencing the sheets in the workbook.
You could just as easily say;

For each sht in ThisWorkbook.Worksheets. You can assign whatever you would
like. Think of it as a quick way to reference the sheets. Look up
variables in the help file.

Yes, the display alerts does what you think it does.

HTH,

Job

"dee" wrote in message
...
Hi,

I'm a newbie and as having trouble grasping something. I'm running code
to
delete all empty sheets in a workbook. The code I have found begins with
Dim sh as Worksheets
For Each sh in ThisWorkbook.Worksheets
If Application.WorksheetFunction.Counta(sh.cells) = 0 Then
application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts=True
End if
Next

My questions is:

What does the sh as Worksheet mean in plain English?
I assume the Displayalerts means don't show me the confirmation message to
delete sheets

Thanks!

--
Thanks!

Dee




Reply
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
automatically appending newly added data on worksheet to a master list worksheet tabylee via OfficeKB.com Links and Linking in Excel 0 December 17th 09 04:24 PM
Upload multiple text files into 1 excel worksheet + put the filename as the first column in the worksheet Aster Excel Worksheet Functions 3 March 12th 06 09:58 AM
I want in one worksheet to relatively link to/reference cells in another without changing the format of the current worksheet. [email protected] Excel Discussion (Misc queries) 0 September 22nd 05 04:39 PM
copy range on every worksheet (diff names) to a master worksheet (to be created) Bernie[_2_] Excel Programming 2 September 22nd 04 03:30 PM
Attaching a JET database to an Excel Worksheet OR storing large binary data in a worksheet Ant Waters Excel Programming 1 September 3rd 03 11:34 AM


All times are GMT +1. The time now is 08:58 AM.

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"