excel - IF THEN VBA MACRO - Update one column if contents of another = 100% -


i have workbook "results" being sheet 3, being worksheet want use.

i have tried few formulaes try , add macro following:

i have column g percentages. have column there result saying true/false contents of g equal 100%. column g formatted percentage 2 decimals.

some considerations: have first row being hyperlink sheet, headings, first row of "results". have 457 rows, if there measurement of range, perhaps on a?

i keep getting error 9 range , have got bit stuck.

thanks in advance!

sub partialhits1()  dim rng range  dim lastrow long  dim cell range   sheet3      lastrow = .range("g" & .rows.count).end(xlup).row      set rng = .range("g1:g" & lastrow)      each cell in rng          if cell.value = 100                       cell.range("i1:i1").value = 100          end if      next  end   end sub  

(i have hacked bit, trying set 100 instead of true/false playing around near sheet 3 part got errors.)

rangevariable.range can refer cell within rangevariable, can't refer column in way. try: .range("i"&cell.row)=100.

also criteria wrong, if have 100% in cell it's actual value 1.

and last question: why want vba, more simple worksheet function =if(g3=1,100,"")


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -