Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default macro can't form a Range on an inactive Worksheet

Thanks Mangesh and JE
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
How do I email an inactive copy of a worksheet Jackaroo 1281 Excel Discussion (Misc queries) 1 January 1st 09 03:36 PM
shortcut key for selecting the inactive cells surrounding a range Michele Excel Worksheet Functions 1 March 30th 08 03:02 AM
macro to change data in inactive sheet Diana Excel Discussion (Misc queries) 1 April 28th 06 08:36 PM
macro to change data in inactive sheet Diana Excel Discussion (Misc queries) 1 April 28th 06 08:10 PM
How to get the activecell of inactive worksheet ? steven[_2_] Excel Programming 5 April 18th 04 12:59 PM


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