0

Hello all I´m currently trying to use "cl.column" to establish a column to use in a loop. The relevant part of my code is below.

The issue I´m having is that because cl.column stores the column as a number I don´t know how to reference it in my loop since it isn´t a letter.

for each cl in activesheet.range("A1:BZ1")
if instr(cl, "Deuda") > 0 then
StoredColumn = cl.column
end if
next cl

for each cl In Workbooks(MesActual).Worksheets("Deuda").Range(ColumnA & "8", ColumnA & CounterA)
Sean Connecticut
  • 305
  • 2
  • 8
  • 14

1 Answers1

0

I am bit confused with your question. You are storing "c.column" in "StoredColumn" but couldn't find where you are trying to use it.

However, Whenever i required to use Range object and if i have column number instead of column letter i will try to use as below. May be this can help you.

Sub test()
   For Each cel In Range("A1:Z1")
     colno = cel.Column
     ActiveSheet.Range(Cells(1, cel.Column).Address) = cel.Column
   Next
End Sub

Thanks, Ramana

KV Ramana
  • 89
  • 3
  • 11