excel vba - How to set a variable equal to a cell address? -


i have find next empty cell in column b (variable coluna_amostras), save address (using variable inserir) , use paste new row data. however, couldn't figure out how store address in inserir variable. it´s defined, excel returns "run-time error 91 - object variable or block variable not set". me? thanks!!

    sub copiaroriginais()       dim certeza vbmsgboxresult     dim sample string     dim coluna_amostras range     dim inserir range           activesheet.name = range("y1").value         sample = range("y1").value      certeza = msgbox("você tem certeza de que os dados originais já não foram copiado? utilizar novamente essa função, após o teste 2-sigma ter sido aplicado, comprometerá os seus dados originais.", vbyesno)          if certeza = vbno end          sheets("results").activate         range("b2").end(xldown).offset(1, 0).select         inserir = activecell    sheets(sample).activate          range("b3:d122").copy         range("b132").pastespecial xlpastevalues         application.cutcopymode = false           worksheets(sample).range("ratio143144").copy              worksheets("results").activate             range("d" & inserir.row).select             activesheet.pastespecial link:=true 

inserir = activecell same inserir.value = activecell.value, fails because inserir nothing.

if want save reference object, must use set:

set inserir = activecell 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -