View Single Post
  #7   Report Post  
Kassie
 
Posts: n/a
Default

Use the following to start with:

Sub CopyName()
Dim rngName As Variant
rngName = InputBox("Insert the Range Name you want to copy")
With ActiveCell
ActiveWorkbook.Names.Add Name:=rngName, RefersTo:=ActiveCell
End With
End Sub

Select the cell you want to name, type in the name, and it will create the
range in the active cell
--
ve_2nd_at. Randburg, Gauteng, South Africa


"Al" wrote:

Just wondering whether my macro can be written along the following lines:

A simple macro for Insert/Name/Define uses the current cell, i.e.
ActiveWorkbook.Names.Add Name:="cellname1", RefersToR1C1:="=Sheet1!R1C1"

If I go to another cell, say R17C11, and run this macro, then it renames
cell R1C1 as "cellname1". Is there a way of having the macro use the "current
cell", something along the lines of....
ActiveWorkbook.Names.Add Name:="cellname1",
RefersTocurrentcell:="=Sheet1!currentcell"




"Al" wrote:

Thanks Kassie....I'll see what I can do with your help!

"Kassie" wrote:

Hi Al

You could use a macro to name the ranges in the other notebooks, but what
worries me is that you say they are not all in the same place? You will have
to pass some criteria to the macro, so that the range names are created with
the correct ranges!

If the macro must ask for ranges everytime it tries to create a range name,
you may as well do it yourself, without having to go the the effort of
writing code to do it!

If these range name referred to similar ranges in the various books, it
would be a breeze of course, to use a macro.

--
ve_2nd_at. Randburg, Gauteng, South Africa


"Al" wrote:

By "cell names" I mean that I have defined certain cell names using
Insert/Name/Define. Say A10 is named "total revenue" in workbook "ABC".

I now want to allocate the same cell name to cell A30 in workbook "XYZ".

Short of renaming the cell in the 2nd workbook - which I'm trying to avoid
becuase I have many cells that are named in "ABC", and dozens of other
workbooks need the same cell names - I'm hoping that I can copy in some way a
name from one book to another. (note the named cells are not necessarily in
the same place in spreadsheet.)



"Kassie" wrote:

Hi Al

Not sure what you mean with "cell names". If you are referring to the
contents of the cell, you can either select the cell, press <Ctrl<C, go
where you want to paste, and press <Ctrl<V, or you can go to where you want
it on the other sheet, type in = click on the source sheet, click on the
particular cell, and hit <Enter
--
ve_2nd_at. Randburg, Gauteng, South Africa


"Al" wrote:

How can I copy cell names from one spreadsheet to another?