Hello,
I have the following sub which works fine with consecutive columns:
Sub ShowColumns()
Dim r As Range, rng As Range
With Sheets(1)
For Each r In .Range(.[A1], .[A1].End(xlDown))
With Sheets(2)
For Each rng In .Range(.[A1], .[A9].End(xlToRight))
If rng.Value = r.Value Then
rng.EntireColumn.Hidden = False
Exit For
End If
Next
End With
Next
End With
End Sub
Problem is that there are formula columns in between each dynamically generated column. When the sub hits the first non-dynamically generated column (not mapped to the cell reference on the lookup sheet) the routine stops and I get one column.
Can someone offer some advice on a solution? Is there a way to handle this in code so the columns skip the non-mapped columns or can the columns be mapped directly in the sub?
Thanks in advance,
Jean Luc
I have the following sub which works fine with consecutive columns:
Sub ShowColumns()
Dim r As Range, rng As Range
With Sheets(1)
For Each r In .Range(.[A1], .[A1].End(xlDown))
With Sheets(2)
For Each rng In .Range(.[A1], .[A9].End(xlToRight))
If rng.Value = r.Value Then
rng.EntireColumn.Hidden = False
Exit For
End If
Next
End With
Next
End With
End Sub
Problem is that there are formula columns in between each dynamically generated column. When the sub hits the first non-dynamically generated column (not mapped to the cell reference on the lookup sheet) the routine stops and I get one column.
Can someone offer some advice on a solution? Is there a way to handle this in code so the columns skip the non-mapped columns or can the columns be mapped directly in the sub?
Thanks in advance,
Jean Luc