Command Button
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 |
Command Button
hi
what error is it generating? regards FSt1 "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 |
Command Button
1. check if there is a worksheet named "Customer Profile" in yr
workbook 2. check if there is a range named "newused" in yr workbook |
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 |
All times are GMT +1. The time now is 06:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com