LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Public declaration

I have a series of macros that depend upon counting a number of
spreadsheets. I wish to determine the exact number prior to runing
the macros. I currently update the variable Numsites manually as a
constant. I tried to automate the process so that prior to to running
any other macros I would know the number of spreadsheets I was dealing
with.

The code below had the following error Compile error: Invalid outside
procedure.

Can you please assist with some options.


Option Explicit
Option Private Module

Public Const NumSites As Integer = 20

Dim NumSites As Integer
For Each Worksheet In Worksheets
Do While Not Worksheet.Name = "File names"
NumSites = NumSites + 1
Exit Do
Loop
Next Worksheet
 
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
Workbook Declaration Varne Excel Discussion (Misc queries) 3 April 29th 08 09:49 AM
which declaration to use Peer Excel Programming 3 August 2nd 04 03:17 PM
Declaration? TJF[_2_] Excel Programming 5 December 18th 03 03:26 PM
public declaration kevin Excel Programming 1 December 6th 03 07:00 PM
Variable Declaration?? Tom Ogilvy Excel Programming 1 August 8th 03 06:45 PM


All times are GMT +1. The time now is 03:32 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"