Ampleford
Active Member
- Joined
- Mar 26, 2002
- Messages
- 380
I'm trying to add a formula to a cell using VB and it keeps stopping, but I can't see where I'm going wrong - can someone maybe help me? I'd like the following formula in Cell BA2 on the tab "Theo"
=IF(SUM(AC2:AD2)=0,"XX",AZ2&"~"&SUM(AC2:AD2)&"-"&Y2) so I'm using the following:-
Sub CalcsToData()
Sheets("Theo").Select
Range(BA2).Value = "=IF(SUM(AC2:AD2)=0,Chr34XXChr34,AZ2&Chr34~Chr34&SUM(AC2:AD2)&Chr34-Chr34&Y2)"
End Sub
But I'm getting the following:-
Run-time error '1004':
Method 'Range' of object '_Global' failed
Can anyone assist?
=IF(SUM(AC2:AD2)=0,"XX",AZ2&"~"&SUM(AC2:AD2)&"-"&Y2) so I'm using the following:-
Sub CalcsToData()
Sheets("Theo").Select
Range(BA2).Value = "=IF(SUM(AC2:AD2)=0,Chr34XXChr34,AZ2&Chr34~Chr34&SUM(AC2:AD2)&Chr34-Chr34&Y2)"
End Sub
But I'm getting the following:-
Run-time error '1004':
Method 'Range' of object '_Global' failed
Can anyone assist?