![]() |
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. |
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. |
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. |
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. |
macro can't form a Range on an inactive Worksheet
Thanks Mangesh and JE
|
All times are GMT +1. The time now is 05:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com