excel vba - Select Cells with Value Greater than Zero -


i have column of values , want select cells greater 0:

example

i tried looking online not find solution. how can vba script, preferably without writing loop?

thank you!

maybe this:

option explicit  sub main()      dim ws worksheet, i&, arr() long, rng range     set ws = thisworkbook.sheets("sheet1")      redim arr(0)     call nonzeroselection(activesheet, i, arr, rng)  end sub  sub nonzeroselection(byref ws worksheet, byref i&, byref arr() long, rng range)     dim lr&, ix$     lr = ws.range("a" & rows.count).end(xlup).row     = 1 lr         set rng = ws.range("a" & i)             if rng.value = "0"                 redim preserve arr(ubound(arr) + 1)                 arr(ubound(arr) - 1) =             end if         set rng = nothing     next     redim preserve arr(ubound(arr) - 1)     = lbound(arr) ubound(arr)         ix = ix & arr(i) & ":" & arr(i) & ","     next     ix = left(ix, len(ix) - 1)     ws.range(ix).select end sub 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -