excel - Sum innertext VBA IE -
i got several numbers present sum of rather having sum afterwards
msgbox ie.document.getelementsbyclassname("post_click_or_post_view_revenue")(0).innertext msgbox ie.document.getelementsbyclassname("post_click_or_post_view_revenue")(1).innertext msgbox ie.document.getelementsbyclassname("post_click_or_post_view_revenue")(2).innertext msgbox ie.document.getelementsbyclassname("post_click_or_post_view_revenue")(3).innertext
i instead
msgbox sum(ie.document.getelementsbyclassname("post_click_or_post_view_revenue").innertext)
is possible?
you have loop through series of tags matching class, converting .innertext
actual number (text looks number if still not number) progress through.
dim dtotal double, l long, e long ie.document l = .getelementsbyclassname("post_click_or_post_view_revenue").length - 1 e = 0 l if isnumeric(trim(.getelementsbyclassname("post_click_or_post_view_revenue")(e).innertext)) _ dtotal = dtotal + cdbl(.getelementsbyclassname("post_click_or_post_view_revenue")(e).innertext) next e end msgbox "the total " & dtotal
now going loop through of elements matching class name. if want go 0 3 use for e = 0 3
. make sure there 4 of them before go loop asking four.
Comments
Post a Comment