excel vba - VBA insert formula with dynamic cell reference -


i creating subtotals , have in empty cells (no sum) of subtotal line reference cell above. formula reference cell above. example: if row 4 subtotal line , cell a4 empty cell formula in a4 read "=a3"

activecell.formula = "=" & cells(-1, "a").address(false, false) 

i have above code written run-time error 1004 application -defined or object defined error.

i have tried code below error out well.

activecell.formula = "=" & cells(-1, a).address(false, false) 

use offset reference cell relative another.

activecell.offset(-1, 0) 

if activecell a4 offset refers a3. use .address property address need in formula. example:

activecell.formula = "=" & activecell.offset(-1, 0).address 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -