+ Reply to Thread
Results 1 to 3 of 3

How to edit (or delete) macros

  1. #1
    Registered User
    Join Date
    01-22-2018
    Location
    Birmingham UK
    MS-Off Ver
    M O H & S 2013
    Posts
    1

    Question How to edit (or delete) macros

    I have set up macros in a large spreadsheet in order to go to a given cell in the spreadsheet. My given cell locations have changed as my spreadsheet has grown and I cannot find out how to edit the macros. Sorry if this is unclear. What am I missing please?

  2. #2
    Banned User!
    Join Date
    09-26-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    607

    Re: How to edit (or delete) macros

    alt+11 to get into VBA

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: How to edit (or delete) macros

    What Billy said plus - VBA does not know when you add or delete rows or columns in a spreadsheet, so code that looks at fixed cells will break when you do this.

    One way around this is to give key cells a name. The simplest way to do this is go to the name box and type the name in. So let's say the cell you are interested in is Cell B6. Select cell B6, go to the name box (upper left near the ribbon) to the name box - chances are it says B6. Select this box and type in a descriptive name like Todays_Date and press ENTER. You have now named cell B6 on that sheet to Todays_Date. Unless you define another Todays_Date on another sheet, cell B6 on this sheet will be known as Todays_Date no matter where you are in the workbook. So you can write formulas using it on other sheets.

    To get to it in VBA, use Range("Todays_Date"). Even if you add or delete columns or rows or even rename the sheet, Excel will keep track of where Todays_Date is. The only rule for names is that they must begin with a letter, they cannot contain spaces, the only punctuation allowed is the underscore and they can't resolve into a cell reference. For example END6 won't work because there is a cell with this address on the sheet. END_6 is OK.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ 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. [SOLVED] edit macros
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-27-2013, 06:35 PM
  2. [SOLVED] Macro to delete/edit other macros
    By Obfuscated in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-09-2012, 10:30 PM
  3. Excel 2007 : Can you edit Macros?
    By Ghost123 in forum Excel General
    Replies: 1
    Last Post: 11-25-2011, 02:56 PM
  4. How do you edit macros?
    By jgomez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2011, 10:31 AM
  5. Replies: 5
    Last Post: 02-17-2010, 02:02 PM
  6. Using Macros to add, delete and edit a CRM in an excel sheet
    By ste_mulv in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-13-2009, 02:43 PM
  7. [SOLVED] How do you edit macros outside of Excel?
    By Jim D. in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2006, 11:35 AM
  8. Add, edit, delete, save functions in excel using macros
    By tweety127 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2006, 05:20 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