Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50057

Macro to delete macro button issues

$
0
0
Hi Guys

I have a situation where I have a code which copies a sheet and renames it a cell value.
But these sheets which have been copied over also have the macro button on which I want deleted.

So I recorded a macro in 2003 excel then had issues when using it in the 1997 excel in work.

The problem I got is: In the newer version, the macro button is called "Button1" but in the older version its called "Button 14"

Is there a way which i can delete this button?

Here is the code below so you can see whats happening:

Code:


    Sheets("Current Week").Select
    Sheets("Current Week").Copy After:=Sheets(1)
    Sheets("Current Week (2)").Select
    ActiveSheet.Shapes("Button 14").Select
    Selection.Delete

    Sheets("Current Week (2)").Name = "Week" & Range("P1").Value
    Sheets("Current Week").Select
   
    Range("F6:S7").Select
    Selection.ClearContents
   
    Range("F10:S11").Select
    Selection.ClearContents
   
    Range("F14:S15").Select
    Selection.ClearContents
   
    Range("F18:S20").Select
    Selection.ClearContents
   
    Range("F23:S25").Select
    Selection.ClearContents
   
    Range("F28:S33").Select
    Selection.ClearContents
     
   
   
    'Range("A1").Select
End Sub


Viewing all articles
Browse latest Browse all 50057

Trending Articles