basepointdesignz
Programmer
Hi,
Does anyone know how to change a cell's value/formula once a command button is pressed? What I want it to do is effectively disable the VAT formula from a cell, so the total cost can be calculated with and without VAT.
I have the following macro attached to the button:
The code comes up with a:
Object variable or With Block variable not set error...
.....and it points to the
line..
What could be happening?
Any ideas?
Cheers,
Paul @ basepoint designz..
basepoint designz
renegade@tiscali.co.uk
Does anyone know how to change a cell's value/formula once a command button is pressed? What I want it to do is effectively disable the VAT formula from a cell, so the total cost can be calculated with and without VAT.
I have the following macro attached to the button:
Code:
Sub disableVAT()
Dim Target As Range 'Range of cells..
Select Case Target.Address
Case Is = "$J$52:$K$53" 'Check state of VAT cell's formula/value..
If Target.Formula = "=J50 * 0.175" Then
Target.Value = "0" ' Change cell's value to 0 (disabling VAT)..
ElseIf Target.Value = "0" Or Target.Value = "" Then
Target.Formula = "=J50 * 0.175"
End If ' Change cell's formula (enabling VAT)..
End Select
End Sub
The code comes up with a:
Object variable or With Block variable not set error...
.....and it points to the
Code:
Select Case Target.Address
What could be happening?
Any ideas?
Cheers,
Paul @ basepoint designz..
basepoint designz
renegade@tiscali.co.uk