View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
ShaneDevenshire ShaneDevenshire is offline
external usenet poster
 
Posts: 2,344
Default Reading variable list of cells into array

Hi,

Don't think you need to use the array:

Sub PrintSheets()
Dim cell As Range
Dim mySheet As String
Range([A4], [A4].End(xlDown)).Select
For Each cell In Selection
mySheet = cell
Sheets(mySheet).Activate
ActiveWindow.SelectedSheets.PrintOut
Next cell
End Sub

--
Thanks,
Shane Devenshire


"Diffus" wrote:

This should be a pretty easy question, but I just can't seem to be
able to figure it out. I've not done much VBA programming with
arrays.

I have in cells A4 through A49 a list of job numbers. Each job number
has not only a row of data on this sheet, but another sheet whose name
is the job number. For exampl, cell A4 contains 99909, and there is
also a sheet named 99909.

The list of jobs varies with each new set of data. For example, next
month, there may be 40 rows of data, and 99909 may not be on the list.

I want to read the sheet names into an array and perform an action
(printing) on the array, something like this:

For each cell in A4 through end of list, add cell value to array
When end of list is reach, print each sheet in array

Thanks in advance.