Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
BJ BJ is offline
external usenet poster
 
Posts: 51
Default Reference Range across Worksheets

In MS Excel Objects Sheet1 (Input) I have the following:

Private Sub CommandButton1_Click()
Sheets("Data").Range("Discounts").Select
Selection.ClearContents
End Sub

Basically I am attempting to select and clear a named range within another
worksheet. I'm getting '1004' error so obviously I'm not calling this
correctly.

Any thoughts? I'm not locked into this format - just my goal of clearing
that named range via the button click from the 'Input' worksheet.

Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Reference Range across Worksheets

Try

Sheets("Data").Range("Discounts").ClearContents

If this post helps click Yes
---------------
Jacob Skaria


"BJ" wrote:

In MS Excel Objects Sheet1 (Input) I have the following:

Private Sub CommandButton1_Click()
Sheets("Data").Range("Discounts").Select
Selection.ClearContents
End Sub

Basically I am attempting to select and clear a named range within another
worksheet. I'm getting '1004' error so obviously I'm not calling this
correctly.

Any thoughts? I'm not locked into this format - just my goal of clearing
that named range via the button click from the 'Input' worksheet.

Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
BJ BJ is offline
external usenet poster
 
Posts: 51
Default Reference Range across Worksheets

Thanks Jacob - works great ... why? Why can I 'do' something across
worksheets as opposed to 'selecting' across worksheets?

"Jacob Skaria" wrote:

Try

Sheets("Data").Range("Discounts").ClearContents

If this post helps click Yes
---------------
Jacob Skaria


"BJ" wrote:

In MS Excel Objects Sheet1 (Input) I have the following:

Private Sub CommandButton1_Click()
Sheets("Data").Range("Discounts").Select
Selection.ClearContents
End Sub

Basically I am attempting to select and clear a named range within another
worksheet. I'm getting '1004' error so obviously I'm not calling this
correctly.

Any thoughts? I'm not locked into this format - just my goal of clearing
that named range via the button click from the 'Input' worksheet.

Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Reference Range across Worksheets

You dont need to select a range to clear its contents....For you question
....you need to select the sheet first before selecting the range

Sheets("Data").Select
Range("Discounts").Select
Selection.ClearContents

If this post helps click Yes
---------------
Jacob Skaria


"BJ" wrote:

Thanks Jacob - works great ... why? Why can I 'do' something across
worksheets as opposed to 'selecting' across worksheets?

"Jacob Skaria" wrote:

Try

Sheets("Data").Range("Discounts").ClearContents

If this post helps click Yes
---------------
Jacob Skaria


"BJ" wrote:

In MS Excel Objects Sheet1 (Input) I have the following:

Private Sub CommandButton1_Click()
Sheets("Data").Range("Discounts").Select
Selection.ClearContents
End Sub

Basically I am attempting to select and clear a named range within another
worksheet. I'm getting '1004' error so obviously I'm not calling this
correctly.

Any thoughts? I'm not locked into this format - just my goal of clearing
that named range via the button click from the 'Input' worksheet.

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
Reference to worksheets Thys Excel Worksheet Functions 4 February 3rd 09 04:59 AM
Reference different worksheets WLMPilot Excel Discussion (Misc queries) 2 December 27th 07 03:42 PM
automatic range - named range give me circular reference... George Thorogood Excel Discussion (Misc queries) 0 February 22nd 07 07:53 PM
Can you get the range reference for each page in a worksheet print range? Crosby Excel Programming 3 April 12th 05 06:06 PM
adding reference-to-range control to excel range Nir Sfez Excel Programming 1 March 2nd 04 06:11 PM


All times are GMT +1. The time now is 10:17 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"