VBA Code Bug

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I'm having a run time error with this code:

NewSht.Range("K72") = OldSht.Range("K69" - "K70" - "K71")

Suggestions?
 
Try

NewSht.Range("K72") = OldSht.Range("K69") - OldSht.Range("K70") -
OldSht.Range("K71")

OR

NewSht.Range("K72") = OldSht.Range("K69") - (OldSht.Range("K70") +
OldSht.Range("K71"))

If this post helps click Yes
 
I will assume that you are trying to subtract ranges K70, K71 from K69?

see if this way helps:

newsht.Range("K72").Value = _
oldsht.Range("K69").Value - WorksheetFunction.Sum(oldsht.Range("K70:K71"))
 
Here is another way do it...

With OldSht.Range("K69")
NewSht.Range("K72").Value = .Value - .Offset(1).Value - .Offset(2).Value
End With
 
Back
Top