+ Reply to Thread
Results 1 to 4 of 4

How to Select sheet name and selection.value together?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    How to Select sheet name and selection.value together?

    This works:

    Formula: copy to clipboard
    Columns(Range("sheet1!AE2").Value).Select


    but instead of AE2 I want to use selection.value

    Tried this but doesn't work:
    Formula: copy to clipboard
    Columns(Range("sheet1!").selection.Value).Select

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,994

    Re: How to Select sheet name and selection.value together?

    Maybe:

    Columns(Range("sheet1!" & selection.Value).Select

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How to Select sheet name and selection.value together?

    Sub b()
    Sheets(1).Select
    Columns(Selection.Value).Select
    End Sub
    If solved remember to mark Thread as solved

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,994

    Re: How to Select sheet name and selection.value together?

    Sheets("sheet1").Range(Selection.Value).EntireColumn.Select

    Note that an easy mistake to make is to press Enter to confirm the value in the cell and then try and run the macro.

    More secure is, for example:

    Sheets("sheet1").Range(Range("C8").Value).EntireColumn.Select

    Regards, TMS

+ 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