Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88126

Copy sheet in Excel macros and update their links [closed]

$
0
0

y and m. Sheets x and y are linked to each other what i want is to use the x and y sheets as a template and create their copy, update their names and links based on a list present in sheet m. can any body please help me. I am new to programming and this is what i learned from the internet.

Sub MAKE()
Dim sh1 As Worksheet, sh2 As Worksheet, C As Range, SH3 As Worksheet
Set sh1 = Sheets("X")
Set sh2 = Sheets("M")
Set SH3 = Sheets("Y")
For Each C In sh2.Range("A2", sh2.Cells(Rows.Count, 1).End(xlUp))

    sh1.Copy BEFORE:=Sheets("M")
    ActiveSheet.Name = C.Value
    SH3.Copy BEFORE:=Sheets("M")
    ActiveSheet.Name = C.Value
        Next
 End Sub

Viewing all articles
Browse latest Browse all 88126

Trending Articles