View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ranswrt ranswrt is offline
external usenet poster
 
Posts: 191
Default 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