I have 2 worksheets. On sheet 1 I have D5 in cell D5. On sheet 2 I have D6 and D7 in cells D6 and D7. When I step thru the program, I get D5 in cell A1. I get D6 in cell A2. What I would like to do is combine the 2 methods and get D7 in cell A3. What I get is a run time error. It seems reasonable that I should be able to do this. Any help would be appreciated. Thank you for your time.
VBA Code:
Sub Formula1()
Range("A1").Formula = "=" & Cells(5, 4)
Range("A2").Formula = "=('" & Sheets(2).Name & "'!D6)"
Range("A3").Formula = "=('" & Sheets(2).Name & "' ""!"" '" & Cells(7, 4) & "')"
End Sub