+ Reply to Thread
Results 1 to 5 of 5

How to Select Sheet in VBA Coding

  1. #1
    Registered User
    Join Date
    02-07-2016
    Location
    Dammam
    MS-Off Ver
    2010
    Posts
    34

    How to Select Sheet in VBA Coding

    Dear Bros,

    i have strucked in the place where i select the sheet to retrieve the data and update.
    Below is the code where i select the sheet.

    I would like to select the sheet by cell value, and not by combobox value.

    Please Login or Register  to view this content.
    I get error "Run-time Error '57121'
    Application define error or object defined error


    Please help me to select the sheet based on cell value.

    Thanks.
    ebin
    Last edited by ebincharles; 01-19-2017 at 12:59 AM.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: How to Select Sheet in VBA Coding

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: How to Select Sheet in VBA Coding

    Quote Originally Posted by ebincharles View Post
    Dear Bros,

    Please Login or Register  to view this content.
    what you are trying to do here is assign a string value (Sheets("Input").Range("AP5").Value) to a worksheet type object (Set historyWks)
    If you want to work with the sheet with the name of that range you could use something like

    Please Login or Register  to view this content.
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  4. #4
    Registered User
    Join Date
    02-07-2016
    Location
    Dammam
    MS-Off Ver
    2010
    Posts
    34

    Re: How to Select Sheet in VBA Coding

    @ bulina 2k

    Thanks for your reply.

    I too tried the same code what you advised.
    Please Login or Register  to view this content.
    Unfortunately i get error,

    Run-time error '57121':
    Application-defined or object-defined error


    Regards

  5. #5
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: How to Select Sheet in VBA Coding

    Capture.PNG



    What is written in Sheets("Input").Range("AP5") ?
    Is there the name of the sheet ?
    Last edited by bulina2k; 01-21-2017 at 10:23 AM. Reason: insert picture

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 04-18-2016, 03:41 PM
  2. Unable to Populate data from Tracker sheet to Result Sheet ples provide vb coding
    By thermax1829 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-01-2015, 07:23 AM
  3. Replies: 3
    Last Post: 11-03-2014, 03:10 AM
  4. [SOLVED] simplifying macro coding (removing.select mostly)
    By alexcrofut in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2014, 11:29 AM
  5. [SOLVED] Excel 2007 : If Then Else and/or Select Case Coding Assistance
    By MrSir in forum Excel General
    Replies: 3
    Last Post: 07-05-2012, 12:48 PM
  6. Re-coding Macro to remove Activate & Select functions
    By kenadams378 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2012, 11:32 AM
  7. how to write coding can make the browse button can select multiple choices
    By ccs_1981 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2008, 01:37 PM

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