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: 7
Default Pass array of sheet names to subroutine

I want to insert a row in one or more adjacent sheets. I have written a
subroutine:

Sub sbrInsertRow(ParamArray avarSheetSub() As Variant)
With Worksheets(avarSheetSub())
.Select
.Rows(5).Insert
.... formatting instructions ...
End With
End Sub

I call the subroutine, sending the names of Sheet 3 to the end:

intSheet=Worksheets.Count-3
For i = 0 To intSheet
avarSheet(i) = Worksheets(i + 3).Name
Next
sbrInsertRow avarSheet

At a breakpoint on the calling line, debug.print correctly enumerates
avarSheet, but at a breakpoint on the With Worksheets line of the sub,
avarSheetSub is empty.

I know I've done something wrong, but what?!?
 
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
Populate an array with sheet names? Steve Excel Programming 1 January 30th 07 08:14 PM
XL2007 and array of sheet names? Jack Sheet Excel Discussion (Misc queries) 0 August 5th 06 02:57 PM
Pass a Variable List Of Values To Subroutine or Function Dean Hinson[_3_] Excel Programming 2 January 28th 05 06:49 PM
How to pass a workshhet name as a parameter into a subroutine ? yigalb Excel Discussion (Misc queries) 4 January 9th 05 10:28 AM
Sheet Names Array Rocky McKinley Excel Programming 2 June 9th 04 11:49 PM


All times are GMT +1. The time now is 10:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"