ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Form buttons and Control Command Buttons (https://www.excelbanter.com/excel-programming/415359-form-buttons-control-command-buttons.html)

ranswrt

Form buttons and Control Command Buttons
 
I was using a button on a worksheet put in using the forms toolbar.
Everything was working fine. I needed to change the buttons to Command
Buttons using the controls toolbox so that I can change the properties on
them. I used the procedure used by the form button for the command button by
using the 'call addestimateitem'. I got an error on the following part of
the code:

With ycell.Validation
.Delete
.Add Type:=xlValidateDecimal, AlertStyle:=xlValidAlertStop, Operator _
:=xlGreater, Formula1:="-9000000"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Error"
.InputMessage = ""
.ErrorMessage = "Must be an Amount."
.ShowInput = True
.ShowError = True
End With

I got an error message

method 'Add' of object 'Validation' failed.

This code worked fine with the form button. I tried putting ycell.select
before the code and that stopped the error.
I then got an error message

method 'Range' of object '_worksheet' failed.

on this line

Range(xcell.Offset(1, 0), xcell.Offset(estnum, 0)).Name = "estdbnorng"

Any Ideas on how I can fix this?
Thanks


All times are GMT +1. The time now is 06:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com