I have this code here, and I want to add an array with [12] (the 12 months).
The lines with // are the ones that I need to implement but I don't understand well how to do it!
The rest works fine :)
Sub titleHere()
Dim i As Long, var As Long
var = 0
//ARRAY[12] arr = {"Jan", "Fev", "Mar", etc...}
//Sheets("arr[0]").Cells(4, 3).Value = Sheets("INTRO").Cells(5, 2).Value
//For m = 1 To 11
For i = 3 To 32
If Cells(i, 19).Value = "C" Or Cells(i, 19).Value = "c" Then
If Cells(i, 20) = 0 Then
var = Sheets("INTRO").Cells(2, 2).Value
Else
var = Sheets("INTRO").Cells(2, 2).Value - Cells(i, 20).Value
End If
Else
var = 0
End If
// Sheets("arr[m]").Cells(4, 3) = Sheets("arr[m]").Cells(4, 3) - var
Next
// Next
End Sub
arr = Array("Jan", "Fev", "Mar")then useSheets(arr(0))and so on.FORloop to:Sheets(arr(0)).Cells(4, 3).Value = Sheets("INTRO").Cells(5, 2).Value. Change theFORstatement to:For m = LBound(arr) To UBound(arr). Then change sheet statement inside theFORloop to:Sheets(arr(m)).Cells(4, 3) = Sheets(arr(m)).Cells(4, 3) - varINTROis one worksheet,Worksheets(arr(m))is another (JantoDec), where isCells(i, 19)located, in a third worksheet? In which worksheet is the code located?