Macro Only Works On One Sheet - Please login or register to view this content. If you try to run the macro on a different sheet, it will not work. Sub data_recording() with workbooks(workbook_name_here).sheets(sheet_name_here) '// change as required. There are a few reasons why a macro might only work on one sheet. I do have a button on sheet 3 that i've assigned to the macro. Web i have the macro working in one sheet, (sheet 3) and when i go to developer, macros and select the macro and press run it doesn't seem to see the range of cells that i've selected. So, in the case that you want to check sheet1, you would change it to this: Web i recorded a macro that works fine, but it will only work on one day's sheet, not the next. Web what's the recommended way to restrict the macro so that it only runs when called from one sheet? You should specify the sheet you want the code to act on, rather than using activesheet.
Sub data_recording() with workbooks(workbook_name_here).sheets(sheet_name_here) '// change as required. Macro works only in one sheet. I do have a button on sheet 3 that i've assigned to the macro. So, in the case that you want to check sheet1, you would change it to this: This means that the macro will only work on that sheet. The macro is using a range that is not defined on the other sheet. Web you need to adapt the code so that all ranges are qualified with a worksheet object, and that no.select or.activate statements are required. Web i recorded a macro that works fine, but it will only work on one day's sheet, not the next. If you try to run the macro on a different sheet, it will not work. Web what's the recommended way to restrict the macro so that it only runs when called from one sheet? You should specify the sheet you want the code to act on, rather than using activesheet. I have no idea how to alter it so that it will work in any tab. If not, can i query the sheet name in the macro and if not the right sheet, either just exit or issue a warning message? Private sub workbook_beforesave(byval saveasui as boolean, cancel as boolean) dim rngcell as range. So i noticed that the sheet name is written into the code which means it will only work with that specific sheet. Web by default, a macro is only associated with the sheet on which it was created. There are a few reasons why a macro might only work on one sheet. Can i restrict the shortcut to just one sheet? I recorded the macro below and i would like to be able to use it on any tab, but it only works on the tab mon. I copied the button and it doesn't work.