excel vba - Compare a cell value (number) with value of counter inside a for -
i'm trying optimize need of lot of case
for
loop. have following code:
dim ws3 worksheet, ultimafila3 long, k long set ws3 = worksheets("lista_riesgos") ws3 ultimafila3 = .listobjects("consolidadoriesgos").range.columns(1).cells.find("*", searchorder:=xlbyrows, searchdirection:=xlprevious).row - 1 k = 1 ultimafila3 if .listobjects("consolidadoriesgos").databodyrange.cells(k, 1).value = k .listobjects("riesgos").databodyrange.cells(k, 1) = .listobjects("riesgos").databodyrange.cells(k, 1) & " " & .listobjects("consolidadoriesgos").databodyrange.cells(k, 1).value end if next k end
it doesn´t work, if change k
i.e. 1
, codes work. i' ve tried val(k)
, creating counter cell in worksheet , comparing cell , neither works.
Comments
Post a Comment