Command Button
Since this code is behind a worksheet, any unqualified ranges will refer to the
worksheet that owns the code (and the button). And I bet that there isn't a
range named "NewUsed" on that sheet with the button.
You could use:
Sheets("Customer Profile").Select
sheets("customer profile").Range("newused") = 1
or (to save typing):
with Sheets("Customer Profile")
.Select
.Range("newused") = 1
end with
But it would be best to drop the select completely:
Sheets("Customer Profile").Range("newused") = 1
If the range is
John Excel wrote:
I have a coomand button that should select a sheet and change the value in a
cell.
The code I have used is as follows, but it generates an error.
Private Sub CommandButton2_Click()
Sheets("Customer Profile").Select
Range("newused") = 1
End Sub
Please advise weere I am going wrong.
Thanks in advance of a favourable reply.
John
--
Dave Peterson
|