View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Sue Sue is offline
external usenet poster
 
Posts: 285
Default Naming a range in a module

Thank you for your time on my problem. I have learnt more from what you have
said but Paul below understood exactly what I was trying to say. Sue

"Incidental" wrote:

Hi Sue

From your code it looks like you have recorded a macro and you are
trying to incorporate it into your code? depending on why you want to
name the range you could use a different method which is to set the
range using VBA.

This code is an example of how setting a range to a variable that you
can refer to in your code. Just copy it into a module and step
through it (pressing the F8 key to run the code line by line) and it
should give you an idea of how it works.

Option Explicit
Dim MyRng As Range 'Declare your range

Sub SetARange()

Set MyRng = Range(ActiveCell, ActiveCell.Offset(1, 0))

[MyRng].Select

[MyRng].Value = "I'm a range called MyRng"

[MyRng].Copy Destination:=[A1]

End Sub

I hope this is of some use to you

Steve