Thread: array question
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Yannick59000 Yannick59000 is offline
external usenet poster
 
Posts: 1
Default array question

Hi, Gary, if we consider the prerequisite that you actually have 12 tabs
named "Jan", "Feb", etc. you can use the following code to associate a letter
to each tab and (in my exemple), put this letter in cell 1,1 of each tab.

I hope I understood your problem all right.

Cheers - Yannick.

Sub TabColLetters()
Dim arr, col As Variant
Dim i As Integer

arr = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", _
"Aug", "Sep", "Oct", "Nov", "Dec")
col = Array("K", "L", "M", "N", "O", "P", "Q", _
"R", "S", "T", "U", "W")

For i = 0 To 11
Worksheets(arr(i)).Cells(1, 1).Value = col(i)
Next i
End Sub



"Gary Keramidas" wrote:

i have sheets name jan, feb, mar and so on.

i want to set a column letter based on the sheetname

just wondering if some sort of array would work instead of a bunch of if
statements

something like this

arr = Array(ActiveSheet.Name("Jan", "Feb", "Mar")
col = Array("K", "L", "M")

just wondering
--


Gary