View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
AM[_3_] AM[_3_] is offline
external usenet poster
 
Posts: 1
Default Copy and paste in VBA


I want to copy the formula in E7 down to the number of
rows that contain data in columns A through D. But this
number may vary. In this example the last row with data
will be 12,073. How can I get VBA to take this into
account?


Range("E7").Formula = "=Sum(B7:D7)"
Range("E7").Copy Destination:=oWorksheet.Range("E8:E12073")