+ Reply to Thread
Results 1 to 4 of 4

Convert vba to affect different sheet

  1. #1
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Convert vba to affect different sheet

    Hi for the life of me I can't work out how to change a macro button to affect another sheet.

    I have this basic code, which works great.

    Please Login or Register  to view this content.
    I want to change it so the button is on Sheet1 and it does the "hide rows" on Sheet19.

    Cheers

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Convert vba to affect different sheet

    Try this:
    Please Login or Register  to view this content.
    Or you could use:
    Please Login or Register  to view this content.
    BSB

  3. #3
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Convert vba to affect different sheet

    Quote Originally Posted by BadlySpelledBuoy View Post
    Try this:
    Please Login or Register  to view this content.
    Or you could use:
    Please Login or Register  to view this content.
    BSB
    Hi the top one came out with "out of range" error but I just changed it to the name of the sheet and that worked. So thank you very much.

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Convert vba to affect different sheet

    The error was probably because you don't have a Sheet(19). The number is like a code number for the sheet rather than the literal name of the sheet or anything to do with it's position relative to other sheets.

    If you open the VBE on a newly created workbook with multiple sheets you'll see each sheet has two names (top left). One being the 'code' version and the other being the literal.

    Glad it's working for you

    BSB

+ 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. Formula which can affect the data on another sheet
    By yanganlin in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-27-2014, 03:36 AM
  2. [SOLVED] How can I use multiple macros that affect different cells in one sheet
    By Silenz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2013, 06:15 AM
  3. Replies: 2
    Last Post: 08-08-2012, 10:58 AM
  4. Replies: 3
    Last Post: 07-11-2006, 01:35 PM
  5. Replies: 0
    Last Post: 05-29-2006, 04:42 PM
  6. inserta row and affect same formula on same sheet
    By Jennifer in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-11-2006, 07:00 AM
  7. [SOLVED] "With Sheets" Issue - macro on one sheet to affect hidden rows on other sheets
    By Punsterr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2006, 12:10 AM

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