Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro can't form a Range on an inactive Worksheet
Hope this isn't too terse, but "my macro can't form a Range on an
inactive Worksheet" seems to cover it. It's Excel 2002 on XP. Hope you can help, I'm baffled. Peter. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro can't form a Range on an inactive Worksheet
If you define the worksheet properly .. e.g.
ThisworkBook.Sheets("SheetName").Range("what_ever_ range) It will work irrespective of where you are writing the code, Worksheet code, ThisWorkBook code or, Module code. Sharad "Peter Chatterton" wrote in message om... Hope this isn't too terse, but "my macro can't form a Range on an inactive Worksheet" seems to cover it. It's Excel 2002 on XP. Hope you can help, I'm baffled. Peter. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro can't form a Range on an inactive Worksheet
It's much too terse. You should have included the code you're trying to
use. One way to "form a Range": Dim rMyRange As Range Set rMyRange = Sheets("Sheet2").Range("A1:J10") but I have no idea whether that's what you mean... In article , (Peter Chatterton) wrote: Hope this isn't too terse, but "my macro can't form a Range on an inactive Worksheet" seems to cover it. It's Excel 2002 on XP. Hope you can help, I'm baffled. Peter. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro can't form a Range on an inactive Worksheet
I don't understand what you mean by "form a Range". I'm guessing you mean
reference a range in a variable? This example will error because Sheet2 is not active. Uncomment the commented line to fix - perhaps this is your issue? Sub test() Dim rng As Range Worksheets("Sheet1").Activate Set rng = Worksheets("Sheet2").Range("A1:E5") ' Worksheets("Sheet2").Activate rng.Select End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "Peter Chatterton" wrote in message om... Hope this isn't too terse, but "my macro can't form a Range on an inactive Worksheet" seems to cover it. It's Excel 2002 on XP. Hope you can help, I'm baffled. Peter. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro can't form a Range on an inactive Worksheet
Thanks Mangesh and JE
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I email an inactive copy of a worksheet | Excel Discussion (Misc queries) | |||
shortcut key for selecting the inactive cells surrounding a range | Excel Worksheet Functions | |||
macro to change data in inactive sheet | Excel Discussion (Misc queries) | |||
macro to change data in inactive sheet | Excel Discussion (Misc queries) | |||
How to get the activecell of inactive worksheet ? | Excel Programming |