+ Reply to Thread
Results 1 to 4 of 4

Range names -VBA

  1. #1
    JOhnUK
    Guest

    Range names -VBA

    Hi, I need a short code that pick up Range names from a
    given number in a cell, and paste elsewhere. The code
    below works, but I have in the region of a thousand named
    ranges, and as you can imagine, if I kept to the way the
    code below is written, it would be extremely long, and
    time consuming.

    If ActiveCell = "4126" Then
    Application.Goto Reference:="A_4126"
    Selection.Copy
    Sheets("Main Page").Select
    Range("B10").Select
    ActiveSheet.Paste
    Application.Goto Reference:="B_4126"
    Selection.Copy
    Sheets("Main Page").Select
    Range("B29").Select
    ActiveSheet.Paste
    Range("A1").Select
    End If
    If ActiveCell = "4128" Then
    Application.Goto Reference:="A_4128"
    Selection.Copy
    Sheets("Main Page").Select
    Range("B10").Select
    ActiveSheet.Paste
    Application.Goto Reference:="B_4128"
    Selection.Copy
    Sheets("Main Page").Select
    Range("B29").Select
    ActiveSheet.Paste
    Range("A1").Select
    End If

    And so on, and so on.
    Any help greatly appreciated
    John


  2. #2
    Bob Phillips
    Guest

    Re: Range names -VBA

    What is wrong with the responses given yesterday?

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "JOhnUK" <[email protected]> wrote in message
    news:[email protected]...
    > Hi, I need a short code that pick up Range names from a
    > given number in a cell, and paste elsewhere. The code
    > below works, but I have in the region of a thousand named
    > ranges, and as you can imagine, if I kept to the way the
    > code below is written, it would be extremely long, and
    > time consuming.
    >
    > If ActiveCell = "4126" Then
    > Application.Goto Reference:="A_4126"
    > Selection.Copy
    > Sheets("Main Page").Select
    > Range("B10").Select
    > ActiveSheet.Paste
    > Application.Goto Reference:="B_4126"
    > Selection.Copy
    > Sheets("Main Page").Select
    > Range("B29").Select
    > ActiveSheet.Paste
    > Range("A1").Select
    > End If
    > If ActiveCell = "4128" Then
    > Application.Goto Reference:="A_4128"
    > Selection.Copy
    > Sheets("Main Page").Select
    > Range("B10").Select
    > ActiveSheet.Paste
    > Application.Goto Reference:="B_4128"
    > Selection.Copy
    > Sheets("Main Page").Select
    > Range("B29").Select
    > ActiveSheet.Paste
    > Range("A1").Select
    > End If
    >
    > And so on, and so on.
    > Any help greatly appreciated
    > John
    >




  3. #3
    JohnUK
    Guest

    Re: Range names -VBA

    Sorry Bob, But I can't access yesterdays post, so I had
    no idea that it was even answered
    John
    >-----Original Message-----
    >What is wrong with the responses given yesterday?
    >
    >--
    >
    >HTH
    >
    >RP
    >(remove nothere from the email address if mailing direct)
    >
    >
    >"JOhnUK" <[email protected]> wrote in

    message
    >news:[email protected]...
    >> Hi, I need a short code that pick up Range names from a
    >> given number in a cell, and paste elsewhere. The code
    >> below works, but I have in the region of a thousand

    named
    >> ranges, and as you can imagine, if I kept to the way

    the
    >> code below is written, it would be extremely long, and
    >> time consuming.
    >>
    >> If ActiveCell = "4126" Then
    >> Application.Goto Reference:="A_4126"
    >> Selection.Copy
    >> Sheets("Main Page").Select
    >> Range("B10").Select
    >> ActiveSheet.Paste
    >> Application.Goto Reference:="B_4126"
    >> Selection.Copy
    >> Sheets("Main Page").Select
    >> Range("B29").Select
    >> ActiveSheet.Paste
    >> Range("A1").Select
    >> End If
    >> If ActiveCell = "4128" Then
    >> Application.Goto Reference:="A_4128"
    >> Selection.Copy
    >> Sheets("Main Page").Select
    >> Range("B10").Select
    >> ActiveSheet.Paste
    >> Application.Goto Reference:="B_4128"
    >> Selection.Copy
    >> Sheets("Main Page").Select
    >> Range("B29").Select
    >> ActiveSheet.Paste
    >> Range("A1").Select
    >> End If
    >>
    >> And so on, and so on.
    >> Any help greatly appreciated
    >> John
    >>

    >
    >
    >.
    >


  4. #4
    Bob Phillips
    Guest

    Re: Range names -VBA

    John,

    Check out Google

    http://tinyurl.com/dqy8g

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "JohnUK" <[email protected]> wrote in message
    news:[email protected]...
    > Sorry Bob, But I can't access yesterdays post, so I had
    > no idea that it was even answered
    > John
    > >-----Original Message-----
    > >What is wrong with the responses given yesterday?
    > >
    > >--
    > >
    > >HTH
    > >
    > >RP
    > >(remove nothere from the email address if mailing direct)
    > >
    > >
    > >"JOhnUK" <[email protected]> wrote in

    > message
    > >news:[email protected]...
    > >> Hi, I need a short code that pick up Range names from a
    > >> given number in a cell, and paste elsewhere. The code
    > >> below works, but I have in the region of a thousand

    > named
    > >> ranges, and as you can imagine, if I kept to the way

    > the
    > >> code below is written, it would be extremely long, and
    > >> time consuming.
    > >>
    > >> If ActiveCell = "4126" Then
    > >> Application.Goto Reference:="A_4126"
    > >> Selection.Copy
    > >> Sheets("Main Page").Select
    > >> Range("B10").Select
    > >> ActiveSheet.Paste
    > >> Application.Goto Reference:="B_4126"
    > >> Selection.Copy
    > >> Sheets("Main Page").Select
    > >> Range("B29").Select
    > >> ActiveSheet.Paste
    > >> Range("A1").Select
    > >> End If
    > >> If ActiveCell = "4128" Then
    > >> Application.Goto Reference:="A_4128"
    > >> Selection.Copy
    > >> Sheets("Main Page").Select
    > >> Range("B10").Select
    > >> ActiveSheet.Paste
    > >> Application.Goto Reference:="B_4128"
    > >> Selection.Copy
    > >> Sheets("Main Page").Select
    > >> Range("B29").Select
    > >> ActiveSheet.Paste
    > >> Range("A1").Select
    > >> End If
    > >>
    > >> And so on, and so on.
    > >> Any help greatly appreciated
    > >> John
    > >>

    > >
    > >
    > >.
    > >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1