Duplicate excelsheet by clicking a specific cell in excel. Possible?

iscon

New Member
Joined
Mar 6, 2019
Messages
2
Hi everyone,

First I must say that this forum is awesome. Everybody wants to help!

So to my question. Is it possible to create a macro that makes it possible to duplicate the activated sheet by clicking a cell (Something like a "hyperlink"). Is this possible to do? I would be grateful if someone took a look at it.

/V
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
How about
Code:
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
   If Target.Address(0, 0) = "A1" Then
      Cancel = True
      Sh.Copy , Sheets(Sh.Index)
   End If
End Sub
This needs to go in the ThisWorkbook module & will copy the active sheet if you double-click A1
 
Upvote 0
Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Double click on Range("A1") and this script will make a duplicate of the sheet

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified  3/7/2019  10:46:43 AM  EST
Cancel = True
Dim ans As String
ans = ActiveSheet.Name
If Not Intersect(Target, Range("A1")) Is Nothing Then
Sheets(ans).Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "New " & ActiveSheet.Index
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,222
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top