Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Worksheet or Me. Why the difference?

Hi Jon

No coincidence whatsoever! That was the problem. Now sorted.

Many thanks.

--
Ian
--

"Jon Peltier" wrote in message
...
All the lines you've marked as failed have an extra set of parentheses
around the range. Coincidence?

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
774-275-0064
http://peltiertech.com/


On 9/9/2010 2:52 PM, IanC wrote:
Hi Bob

I thought that should be the case. All the names ranges are on the Lookup
sheet and referenced as such, but it's wierd that some apply correctly
and
others fail. I can't see what the difference is.

Oh well. It looks like I'll have to be happy sticking with
Worksheets("Checklist").

--
Ian
--
"Bob wrote in message
...
It should apply to them all if they are ranges within that worksheet, if
another worksheet then they won't apply.

--

HTH

Bob

wrote in message
...
Hi Bob

Thanks for the response.

The code is contained in the worksheet, so Me should equate to
Worksheets("Checklist") and appears to in some cases. I can't
understand
why it works for some named ranges, but not others.

Any ideas?

--
Ian
--

"Bob wrote in message
...
You can only use Me when there is a containing object (Me) in
question,
such
as in Userform code (Me if the form), in ThisWorkbook code module (Me
is
the
workbook), or in a worksheet code module (Me is the worksheet).

--

HTH

Bob

wrote in message
...
I have some code which is confusing me. The code copies some named
ranges
from Lookup to specific locations on Checklist.

This code works fine:

With Worksheets("Checklist")
[Lookup!InstruSoftware].Copy .Range("I2")
[Lookup!TubeCount].Copy .Range("U3")
[Lookup!Alpha_kV].Copy .Range("A6")
[Lookup!Alpha_AEC].Copy .Range("A18")
[Lookup!Alpha_Errors].Copy (.Range("O6")) 'xxxx
[Lookup!AlphaAlignment].Copy .Range("Y6")
[Lookup!Alpha_Mechanical].Copy (.Range("Y15")) 'xxxx
[Lookup!Alpha_Electrical].Copy (.Range("Y30")) 'xxxx
[Lookup!Alpha_Earthing].Copy (.Range("O28")) 'xxxx
End With

If I change Worksheets("Checklist") to Me, I get an error for each of
the
marked lines. The error is "Run-time error '1004': Copy method of
Range
class failed".

The destination sheet is unprotected and there are no merged cells in
the
destination ranges.

Can anyone explain why there is this difference between using Me and
the
sheet name?

--
Ian
--















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
compare excel worksheet and output difference to new worksheet Deb Excel Discussion (Misc queries) 1 October 31st 08 02:26 PM
what is the difference between a worksheet and a workbook? unbornsin Excel Worksheet Functions 1 July 25th 07 06:58 AM
comparing worksheet and Marking the difference klafert Excel Worksheet Functions 2 January 15th 07 05:28 PM
what's the difference between Activate and Select for Worksheet? lvcha.gouqizi Excel Programming 1 October 28th 05 05:53 PM
Difference b/w 2 worksheet crapit Excel Programming 3 July 14th 04 04:23 PM


All times are GMT +1. The time now is 06:03 AM.

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"