Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Difficulty placing active email / hyperlinks with normal text in c | Excel Discussion (Misc queries) | |||
placing a button directly in a sheet | Excel Discussion (Misc queries) | |||
help with placing Logo on excel sheet | Excel Discussion (Misc queries) | |||
Option Buttons move after placing on sheet | Excel Worksheet Functions | |||
Placing an array on the active sheet | Excel Programming |