Named Range problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grego9
    New Member
    • Feb 2007
    • 63

    Named Range problem

    Can anyone tell me how to create a named range that can then be referred to later in VBA for excel 2000. At the minute I am simply expanding any ranges out to the maximum possible size before running my scripts on them. Ideally I would like some code that identifies what the data range is each time.

    My current code is just Range("N2:N4000 ").select

    where the 4000th row is definitely beyond where the data ends.


    Any help would be greatly appreciated

    thanks
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    ActiveSheet.Use dRange.Rows.Cou nt

    Gives you Number of rows used..

    REgards
    Veena

    Comment

    • grego9
      New Member
      • Feb 2007
      • 63

      #3
      Thanks Veena - so how would I add that into my code? If I want the task to apply to the range (N2:N(ActiveShe et.UsedRange.Ro ws.Count)) - how would I write that?


      thanks again





      ActiveSheet.Use dRange.Rows.Cou nt

      Gives you Number of rows used..

      REgards
      Veena[/QUOTE]

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        Try this:

        [code=vb]
        Dim RStr As String
        RStr = "N2:N" & ActiveSheet.Use dRange.Rows.Cou nt
        Range(RStr).sel ect
        [/code]

        Regards
        Veena

        Comment

        • grego9
          New Member
          • Feb 2007
          • 63

          #5
          Worked a treat - thanks a lot

          Comment

          Working...