loops - Vba Help in code to clear columns with 0,00 VBA -
i know how code clean has 0.00 column 8 onwards , finish written columns jump next line, end thank comments , help.
dim rng range dim lin, col integer
lin = 2 col = 10 cells(lin, col).select while activecell.value <> "" while activecell.value <> "" if activecell.value = ",00" activecell.value = "" end if col = col + 1 cells(lin, col).select loop lin = lin + 1 col = 10 cells(lin, col).select loop
here have done instead. first find last column , row no data. loop col 8 last col no data, , each col loop each row find cell value contains 0,00.
option explicit 'loop col 8 go through each line , remove 0,00 sub removezeros() dim colno long dim rowno long dim lastcolno long dim lastrowno long dim ws worksheet 'assuming sheet name sheet1 set ws = thisworkbook.sheets("sheet1") ws 'find last column , row no data lastcolno = .cells(1, .columns.count).end(xltoleft).column lastrowno = .cells(.rows.count, 1).end(xlup).row 'loop through each col , row find value 0,00 colno = 8 lastcolno rowno = 1 lastrowno if .cells(rowno, colno).value = "0,00" .cells(rowno, colno).value = "" end if next rowno next colno end end sub
Comments
Post a Comment