excel - PEBKAC Code Throwing "Runtime Error 13", but when I hit debug it does what I want it to -


so i've been teaching myself vba (day 3, still new) , i'm embarking on big new project. part of job going extracting information small range (say q2:v22), summing , sending sum value location.

so here's have:

application.screenupdating = false   set rnga = range("r2", range("c30").end(xlup)) each cell in rnga     if cell.value = 7         cell.offset(0, 4).copy         range("p" & rows.count).end(xlup).offset(1, 0).select     selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks:=false, transpose:=false     application.cutcopymode = false     end if  range("p1") = "=sum(p2:p23)" 

its total hack job of veterans out there, i'm teaching myself.

anyhow, when go ahead , run this, it'll throw error, after i'll hit debug. excel give me vba window "if cell.value = 7 then" line highlighted.

this going first part of long process me (which forward learning go) have no idea why line tripping things up. i'd love can given!

(btw i've been searching answer or alternate way i'm doing , i'm asking because haven't found other answers)

solved:

c30 != r30


Comments