excel vba - vba find first non-blank row -


i'm new vba , struggling piece of code.

i need find first non-empty row conditions simultaneously met. there must text in col b , c , number in col d , g (all 4 conditions must met).

i'd grateful s

you may want nest specialcells() method follows:

sub main()      worksheets("conditions") '<--| change "conditions" actual worksheet name         .range("b1", .cells(.rows.count, "b").end(xlup)) '<-- refer column "b" cells down last non empty 1             .specialcells(xlcelltype.xlcelltypeconstants, xltextvalues) '<-- refer "text" cells                 .offset(, 1).specialcells(xlcelltype.xlcelltypeconstants, xltextvalues) '<-- refer adjacent column "text" cells                     .offset(, 1).specialcells(xlcelltype.xlcelltypeconstants, xlnumbers) '<-- refer adjacent column "number" cells                         .offset(, 1).specialcells(xlcelltype.xlcelltypeconstants, xlnumbers) '<-- refer adjacent column "number" cells                             msgbox .cells(1, 1).row '<--| first "multifiltered" cells row                         end                     end                 end             end         end     end  end sub 

you may need add test before each specialcells() check "current" column has text/numbers value, using mix of count() , counta() method


Comments