Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Select Sheet then Select Range

I'm having trouble with a button I created. When clicked
it's supposed to go to sheet "SOURCE 1" and then to Cell
H77. I keep getting the message "Select Method of Range
Class has Failed"

Private Sub CommandButton31_Click()
Sheets("SOURCE 1").Select
Range("H77").Select
End Sub

Any ideas what I'm doing wrong?

Thank you for any help you can give me,
Gee
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Select Sheet then Select Range

Hi
in most cases no need to select sheets / ranges. e.g. try:
Private Sub CommandButton31_Click()
dim wks as worksheet
dim rng as range
set wks = activeworkbook.workSheets("SOURCE 1")
set rng = wks.Range("H77")
msgbox rng.value
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"Gee" schrieb im Newsbeitrag
...
I'm having trouble with a button I created. When clicked
it's supposed to go to sheet "SOURCE 1" and then to Cell
H77. I keep getting the message "Select Method of Range
Class has Failed"

Private Sub CommandButton31_Click()
Sheets("SOURCE 1").Select
Range("H77").Select
End Sub

Any ideas what I'm doing wrong?

Thank you for any help you can give me,
Gee


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Select Sheet then Select Range

Gee

not sure quite why this works, but try it anyway:

Sheets("SOURCE 1").Select
With Sheets("SOURCE 1")
.Range("H77").Select
End With

Regards

Trevor


"Gee" wrote in message
...
I'm having trouble with a button I created. When clicked
it's supposed to go to sheet "SOURCE 1" and then to Cell
H77. I keep getting the message "Select Method of Range
Class has Failed"

Private Sub CommandButton31_Click()
Sheets("SOURCE 1").Select
Range("H77").Select
End Sub

Any ideas what I'm doing wrong?

Thank you for any help you can give me,
Gee



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Select Sheet then Select Range

Thanks, Trevor...worked perfectly!
Frank...that was useful, but I needed it to actually go to
the cell...though I'm going to keep that bit of
code 'cause I'm going to need it on another
project...you're psychic!
Gee
-----Original Message-----
Gee

not sure quite why this works, but try it anyway:

Sheets("SOURCE 1").Select
With Sheets("SOURCE 1")
.Range("H77").Select
End With

Regards

Trevor


"Gee" wrote in

message
...
I'm having trouble with a button I created. When

clicked
it's supposed to go to sheet "SOURCE 1" and then to Cell
H77. I keep getting the message "Select Method of Range
Class has Failed"

Private Sub CommandButton31_Click()
Sheets("SOURCE 1").Select
Range("H77").Select
End Sub

Any ideas what I'm doing wrong?

Thank you for any help you can give me,
Gee



.

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
Can't Select Range off sheet from inputbox Jim May Excel Discussion (Misc queries) 4 September 29th 07 08:26 PM
Select data to appear on 2nd sheet by date range... Cbreze Excel Discussion (Misc queries) 0 June 28th 07 12:10 AM
sheet protection - only selected range to be able to select/input data Corey Excel Worksheet Functions 7 February 13th 07 05:41 PM
select a range, copy it to a new sheet Dave F Excel Discussion (Misc queries) 1 September 22nd 06 08:06 PM
Automatically select range and copy to new sheet Alistair[_2_] Excel Programming 3 October 11th 03 04:33 AM


All times are GMT +1. The time now is 02:52 AM.

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"