ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection Failed (https://www.excelbanter.com/excel-programming/292409-selection-failed.html)

Fernando Ortiz

Selection Failed
 
Hi Excel Experts:

I am working on a macro and find this

The CommandButton1 is in the sheet1 and when click on it, the code failed
and error 1004 apears

I dont't understand why.

This code is on the sheets1

Private Sub CommandButton1_Click()
Sheets(2).Select
RowEmpty = Range("A1").CurrentRegion.Rows.Count + 1
Cells(RowEmpty, 1).Select
End Sub

Thanks a lot for any advice.

Regards,


Fernando Ortiz




Don Guillett[_4_]

Selection Failed
 
I just tested with a regular button/shape and it worked just fine. I do NOT
like using the command buttons. Look at the forms tools for your button.

--
Don Guillett
SalesAid Software

"Fernando Ortiz" wrote in message
...
Hi Excel Experts:

I am working on a macro and find this

The CommandButton1 is in the sheet1 and when click on it, the code failed
and error 1004 apears

I dont't understand why.

This code is on the sheets1

Private Sub CommandButton1_Click()
Sheets(2).Select
RowEmpty = Range("A1").CurrentRegion.Rows.Count + 1
Cells(RowEmpty, 1).Select
End Sub

Thanks a lot for any advice.

Regards,


Fernando Ortiz






Ron de Bruin

Selection Failed
 
Hi Fernando

If you use Excel 97? then

Change the takefocusonclick property to false of the button
This is a bug in Excel 97


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Fernando Ortiz" wrote in message ...
Hi Excel Experts:

I am working on a macro and find this

The CommandButton1 is in the sheet1 and when click on it, the code failed
and error 1004 apears

I dont't understand why.

This code is on the sheets1

Private Sub CommandButton1_Click()
Sheets(2).Select
RowEmpty = Range("A1").CurrentRegion.Rows.Count + 1
Cells(RowEmpty, 1).Select
End Sub

Thanks a lot for any advice.

Regards,


Fernando Ortiz







All times are GMT +1. The time now is 11:06 PM.

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