Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Problem copying named range

I have a named range on a Lookup sheet which I am trying to copy to a
destination on the main sheet (Mobiles).

The range named PlugIn occupied V4:Z4 on the Lookup sheet and has a border
round the entire area (none internal). This is a region title and only has
text in V4.

Using the following bits of code to copy the range to V6 on the Mobiles
sheet, I end up with the text in V6 as expected, but the border only
surrounds V6, not V6:Z6.

With Worksheets("Lookup")
Set PlugIn = .Range("PlugIn")
End With

PlugIn.Copy (Worksheets("Mobiles").Range("V6"))

I've tried merging V4:Z4 in Lookup, but exactly the same thing happens.
I've tried also merging the cells before copying, but then the border is
completely missing

I know I can copy the range then apply the border, but this shouldn't be
necessary.

Any ideas?

--
Ian
--



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Problem copying named range

Hi Don

Thanks for the response

"Don Guillett" wrote in message
...
Sub copyplugin()' should work from anywhere in the workbook.
Range("plugin").Copy Sheets("mobiles").Range("v6")
End Sub


This gives me Run-time error '1004': - Method 'Range' of object '_Worksheet'
failed.

I had previously looked carefully at the formatting of the destination area,
but couldn't see anything wrong. I didn't think to check the named range.
Although V4:Z4 was merged, and selecting it showed PlugIn in the name box,
the actual named range was only V4. Once I corrected this, my original code
works.

With Worksheets("Lookup")
Set PlugIn = .Range("PlugIn")
End With

PlugIn.Copy (Worksheets("Mobiles").Range("V6"))


I still can't get your code to work, though. It would be good if I could
figure out where it's failing as I currently have many Set lines in my code
(this particular workbook has 25, but I have several similar workbooks and
each has more named ranges than the one I'm currently working on (the most
involved workbook has nearly 100 Set lines). With your code I could do away
with the Set lines and pass named & destination ranges to your subroutine
instead.

Any thoughts?

--
Ian
--
"IanC" wrote in message
...
I have a named range on a Lookup sheet which I am trying to copy to a
destination on the main sheet (Mobiles).

The range named PlugIn occupied V4:Z4 on the Lookup sheet and has a
border round the entire area (none internal). This is a region title and
only has text in V4.

Using the following bits of code to copy the range to V6 on the Mobiles
sheet, I end up with the text in V6 as expected, but the border only
surrounds V6, not V6:Z6.


I've tried merging V4:Z4 in Lookup, but exactly the same thing happens.
I've tried also merging the cells before copying, but then the border is
completely missing

I know I can copy the range then apply the border, but this shouldn't be
necessary.

Any ideas?

--
Ian
--






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Problem copying named range

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"IanC" wrote in message
...
Hi Don

Thanks for the response

"Don Guillett" wrote in message
...
Sub copyplugin()' should work from anywhere in the workbook.
Range("plugin").Copy Sheets("mobiles").Range("v6")
End Sub


This gives me Run-time error '1004': - Method 'Range' of object
'_Worksheet' failed.

I had previously looked carefully at the formatting of the destination
area, but couldn't see anything wrong. I didn't think to check the named
range. Although V4:Z4 was merged, and selecting it showed PlugIn in the
name box, the actual named range was only V4. Once I corrected this, my
original code works.

With Worksheets("Lookup")
Set PlugIn = .Range("PlugIn")
End With

PlugIn.Copy (Worksheets("Mobiles").Range("V6"))


I still can't get your code to work, though. It would be good if I could
figure out where it's failing as I currently have many Set lines in my
code (this particular workbook has 25, but I have several similar
workbooks and each has more named ranges than the one I'm currently
working on (the most involved workbook has nearly 100 Set lines). With
your code I could do away with the Set lines and pass named & destination
ranges to your subroutine instead.

Any thoughts?

--
Ian
--
"IanC" wrote in message
...
I have a named range on a Lookup sheet which I am trying to copy to a
destination on the main sheet (Mobiles).

The range named PlugIn occupied V4:Z4 on the Lookup sheet and has a
border round the entire area (none internal). This is a region title and
only has text in V4.

Using the following bits of code to copy the range to V6 on the Mobiles
sheet, I end up with the text in V6 as expected, but the border only
surrounds V6, not V6:Z6.


I've tried merging V4:Z4 in Lookup, but exactly the same thing happens.
I've tried also merging the cells before copying, but then the border is
completely missing

I know I can copy the range then apply the border, but this shouldn't be
necessary.

Any ideas?

--
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
Copying named range returns #N/A Fergus[_2_] Excel Programming 1 April 27th 09 08:39 PM
Copying Named Range Blinkinhek Excel Worksheet Functions 5 August 29th 08 04:54 PM
copying a named range jenniebentham Excel Discussion (Misc queries) 0 December 20th 06 04:51 PM
copying named range ym Excel Discussion (Misc queries) 3 June 4th 06 04:47 PM
Copying a named range of cells Darrel[_3_] Excel Programming 1 October 29th 03 04:59 PM


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