Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Placing values in a range on a non-active sheet

Do I have to select a sheet before placing values in a range?

This works:
Sheets("Product").select
Range(Cells(1, 2), Cells(1, 11)).Value = 1000

This doesn't:
Sheets("Product").Range(Cells(1, 2), Cells(1, 11)).Value = 1000

Thanks in advance.
Daniel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Placing values in a range on a non-active sheet

You can do it but you have to be very explicit with all of your
references.Something like this will work

Sheets("Product").Range(Sheets("Product").Cells(1, 2),
Sheets("Product").Cells(1, 11)).Value = 1000

or you could use a with statement

with Sheets("Product")
.Range(.Cells(1, 2), .Cells(1, 11)).Value = 1000
end with

HTH

"Daniel Bonallack" wrote:

Do I have to select a sheet before placing values in a range?

This works:
Sheets("Product").select
Range(Cells(1, 2), Cells(1, 11)).Value = 1000

This doesn't:
Sheets("Product").Range(Cells(1, 2), Cells(1, 11)).Value = 1000

Thanks in advance.
Daniel

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Placing values in a range on a non-active sheet

That's because you haven't qualified Cells.

With Sheets("Product")
.Range(.Cells(1, 2), .Cells(1, 11)).Value = 1000
End With

should work.

--

Vasant


"Daniel Bonallack" wrote in
message ...
Do I have to select a sheet before placing values in a range?

This works:
Sheets("Product").select
Range(Cells(1, 2), Cells(1, 11)).Value = 1000

This doesn't:
Sheets("Product").Range(Cells(1, 2), Cells(1, 11)).Value = 1000

Thanks in advance.
Daniel



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Placing values in a range on a non-active sheet

Thanks very much (and to Vasant).



"Jim Thomlinson" wrote:

You can do it but you have to be very explicit with all of your
references.Something like this will work

Sheets("Product").Range(Sheets("Product").Cells(1, 2),
Sheets("Product").Cells(1, 11)).Value = 1000

or you could use a with statement

with Sheets("Product")
.Range(.Cells(1, 2), .Cells(1, 11)).Value = 1000
end with

HTH

"Daniel Bonallack" wrote:

Do I have to select a sheet before placing values in a range?

This works:
Sheets("Product").select
Range(Cells(1, 2), Cells(1, 11)).Value = 1000

This doesn't:
Sheets("Product").Range(Cells(1, 2), Cells(1, 11)).Value = 1000

Thanks in advance.
Daniel

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
Difficulty placing active email / hyperlinks with normal text in c RPD Excel Discussion (Misc queries) 2 March 21st 07 07:05 PM
placing a button directly in a sheet kemel Excel Discussion (Misc queries) 1 August 1st 06 03:25 PM
help with placing Logo on excel sheet Soth Excel Discussion (Misc queries) 4 July 11th 05 10:11 PM
Option Buttons move after placing on sheet james549 Excel Worksheet Functions 2 January 20th 05 05:05 AM
Placing an array on the active sheet M R Excel Programming 0 July 14th 03 12:11 AM


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