Create a new sheet in excel

juca73

New Member
Joined
Dec 30, 2017
Messages
40
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hi All,

I have a two sheets a master sheet and a weekly report sheet.

I need to firstly recreate the previous weeks weekly report sheet based on the cell value i put on the master sheet

For example

Column A ( Master Sheet ) is the week numbers A2=WK27,A3=WK28 Etc when i add WK29 into cell A4.

I then want to ,with the aid of a button and vba, create a copy of the previous weeks weekly report as a new tab

Secondly, if this has been created i need to copy the number value in H5 into column B4 and H6 into column C4 on the master sheet.

Is this possible?

Thanks in advance
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I believe using a Double click script would be best. No button required.
With this script when you double click on any cell in column A of sheet named "Master" the script will run

You need to enter WK2 for example in a cell in Range("A2") And in Range("A1") you have WK1.

Sheet named WK1 will be copied to a new sheet which will be named WK2

Double clicking makes it hard for you to make a mistake.

So the cell you double click on must have the new sheet name.
The cell above the cell you double click on Will be the sheet you copy

I do not understand this part of your question:

Secondly, if this has been created i need to copy the number value in H5 into column B4 and H6 into column C4 on the master sheet.

Copy number value in Range"H5") of what sheet?
And paste Where?

You need to say exactly what to copy and where to paste.

Give both sheet names and Ranges

Like Copy Range("A1") of sheet named "Master"
And paste value in New sheet Range("G2")

Here is the script I now have:

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

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified  7/23/2019  2:56:19 AM  EDT
If Target.Column = 1 Then
Cancel = True
On Error GoTo M
If Target.Value = "" Or Target.Offset(-1).Value = "" Then
MsgBox "No value in Target Or above Target" & vbNewLine & "I will stopt the script": Exit Sub
End If
Sheets(Target.Offset(-1).Value).Copy After:=Sheets(Sheets.Count): ActiveSheet.Name = Target(1).Value
Target.Interior.Color = vbGreen
End If
Exit Sub
M:
MsgBox "We had a problem." & vbNewLine & "You may have had a improper name or some other problem"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,737
Messages
6,180,665
Members
452,992
Latest member
TokugawaIesuma

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