Hi everyone,
I need to make an add-in that copies and pastes the values of very sheet in the workbook. I tried running this code and it worked:
Sub Saveasvalue()
Dim wsh As Worksheet
For Each wsh In ThisWorkbook.Worksheets
wsh.Cells.Copy
wsh.Cells.PasteSpecial xlPasteValues
Next
Application.CutCopyMode = False
End Sub
However, after saving it as an add-in, it doesn't do anything when I run it. To be clear, these were the steps I took:
- Opened new Excel workbook
- Opened VBA
- Right-clicked VBAProject (Book1), Insert -> Module
- Pasted above code into new module
- Closed VBA
- Saved worksheet as Saveasvalue.xlsm
- Saved worksheet as Excel Add-in in the Add-in folder folder
- Went to Developer -> Excel Add-ins, selected Saveasvalues, hit OK
- Added Saveasvalues add-in to quick access toolbar
From there, when I hit the icon on the toolbar, literally nothing happens. I have a few other add-ins that were saved the exact same way as far as I can remember and they work fine, so I'm not sure if I'm missing some small step in saving it correctly or if the code doesn't work when it's an add-in or what. I'm not all that experienced with this stuff, would really appreciate any help.
I need to make an add-in that copies and pastes the values of very sheet in the workbook. I tried running this code and it worked:
Sub Saveasvalue()
Dim wsh As Worksheet
For Each wsh In ThisWorkbook.Worksheets
wsh.Cells.Copy
wsh.Cells.PasteSpecial xlPasteValues
Next
Application.CutCopyMode = False
End Sub
However, after saving it as an add-in, it doesn't do anything when I run it. To be clear, these were the steps I took:
- Opened new Excel workbook
- Opened VBA
- Right-clicked VBAProject (Book1), Insert -> Module
- Pasted above code into new module
- Closed VBA
- Saved worksheet as Saveasvalue.xlsm
- Saved worksheet as Excel Add-in in the Add-in folder folder
- Went to Developer -> Excel Add-ins, selected Saveasvalues, hit OK
- Added Saveasvalues add-in to quick access toolbar
From there, when I hit the icon on the toolbar, literally nothing happens. I have a few other add-ins that were saved the exact same way as far as I can remember and they work fine, so I'm not sure if I'm missing some small step in saving it correctly or if the code doesn't work when it's an add-in or what. I'm not all that experienced with this stuff, would really appreciate any help.