I am attempting to write code to enter a formula into a particular cell prior to hiding the entire column however I am having trouble with the syntax of the formula itself.
So far I have defined the variable i
as a string and it is defined correctly. i
will have a text value of jan
, feb
, mar
, etc.
Below is what code I have currently:
Dim i as string
For Each cell In range("B4:M4")
If cell.Value = "No Data" Then
cell.Select
i = Selection.Offset(-1, 0).Value
Selection.Formula = "=+" & i & "18'!E66"
Selection.EntireColumn.Hidden = True
End If
Next cell
Any help would be greatly appreciated! Thanks!