I am trying to loop though a worksheet to get some data. With that data I am trying to do a calculation and output to another worksheet directly (I want the formula to be on the sheet).
I loop through each column (first row) to see if has data. If it has, the calculation is performe. Problem is I am using concatenate and a variable to count the rows, but that does not work with the columns.
The code is:
Sub OutputManager()
Dim x As Long
Dim lRow As Long, lColumn As Long
Dim LastRow As Long, LastColumn As Long
Dim ws As Worksheet
'find date limits
LastRow = Worksheets("TIME").Cells(Rows.Count, "A").End(xlUp).Row
LastColumn = Worksheets("TIME").Cells(1, Columns.Count).End(xlToLeft).Column
'enter an if loop to find an index
For lColumn = 2 To LastColumn
If Worksheets("TIME").Cells(1, lColumn) <> "" Then
For lRow = 3 To LastRow
Worksheets("Ret").Cells(lRow, lColumn) = "='TIME'!" & lColumn & lRow & "/'TIME'!" & lColumn & lRow - 1 & "-1"
'***** problem with the lcolumn, it gives a number and not a "A" or "B"
Next lRow
End If
Next lColumn
Any ideas on how to do that?