Button vs Command Button
Private Sub T12_Click()
Sheets("T1-05")select
Sheets("T1-05").Range("A17").Select
' or
' Sheets("T1-05")select
' Activesheet.Range("A17").Select
' or
' with Sheets("T1-05")
' .select
' .range("A17").select
' End With
End Sub
Unqualified ranges in the worksheet module are the equivalent of
me.Range("A17").Select
since me (the sheet containing the code) is not the activesheet, you can't
select Range("A17") on that sheet and you get an error
--
Regards,
Tom Ogilvy
"Dan" wrote in message
...
I have a workbook where I used a button and assigned the following macro:
Private Sub T12_Click()
Sheets("T1-05").Select
Range("A17").Select
End Sub
In revamping the sheet I used a command button and loaded the code in to
it.
Works fine in the button, in the Command button I get a Run-time 1004
Select
method of Range class failed. Why is this happen. A17 had data in it
though
it is linked from another sheet in the same workbook
Secondly if you have a sheet that uses many buttons mostly for navigation
which would be the better route the macro with the button or the coded
command. Trying to keep file size down. Thanks
|