Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Button vs Command Button

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Button vs Command Button

Hi

Adding to Tom:
Try a hyperlink, the blue underlined navigation thing as in a webpage.
Insert Hyperlink menu. No code, intuitive user interface when done.

HTH. Best wishes Harald

"Dan" skrev i melding
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
command button abfabrob Excel Discussion (Misc queries) 5 October 7th 05 12:54 AM
Button vs Command Button Dan Excel Programming 1 September 10th 04 01:34 PM
How to tab to a command button? Sameer[_5_] Excel Programming 3 July 27th 04 04:43 AM
Command Button vs Control Button RGibson Excel Programming 1 October 14th 03 02:24 AM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM


All times are GMT +1. The time now is 08:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"