I hope this isn't considered double posting. My other post began to stray from the original topic, so I thought I should post a new topic.
I have a formula in 'Sheet 2'!AC4 (it's actually a variable column, but that I can work out later) that I need to reference in a totals sheet. If I type the cell reference in Excel, the value is reported splendidly. But, I need to enter the cell reference in VBA. Here is the code that I am using in VBA that should accomplish this, but is resulting in simply a blank cell - no data entered at all.
This is the formula entered in the cell I want to reference - 'Sheet 2'!AC4
And here is the code that I have to reference that cell in a newly created column on Totals. I change ActiveCell to C3 and then I have this code.
This code works for a string that is in Sheet 2 (a.k.a. NewSem)!A2.
The only difference between these two references is that A2 has a string (Fall 2005, for instance) while AC4 has a formula with INDIRECT. This is really strange too, because the two similar code snippets above work completely differently, but if I type
in the cell where I want the reference to appear, it works just fine. I just don't know why VBA can't handle this. :-/
I have a formula in 'Sheet 2'!AC4 (it's actually a variable column, but that I can work out later) that I need to reference in a totals sheet. If I type the cell reference in Excel, the value is reported splendidly. But, I need to enter the cell reference in VBA. Here is the code that I am using in VBA that should accomplish this, but is resulting in simply a blank cell - no data entered at all.
This is the formula entered in the cell I want to reference - 'Sheet 2'!AC4
Code:
=SUM(INDIRECT("B4:"&ADDRESS(ROW(),COLUMN()-1)))
Code:
ActiveCell.Value = "='" & NewSem & "'!AC4"
Code:
ActiveCell.Offset(0, LastSheet - 1).Value = "='" & NewSem & "'!A2"
Code:
='Sheet 2'!AC4