ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA Question - Bernie Deitrick helped me previously (https://www.excelbanter.com/excel-discussion-misc-queries/180723-vba-question-bernie-deitrick-helped-me-previously.html)

robert morris

VBA Question - Bernie Deitrick helped me previously
 

I have a Workbook (w/b) with 50 odd Worksheets (w/s)starting with a
"Summary" w/s and a blank "Master w/s" which is copied for each new name
added. VBA as follows;

Sub MakeLinks()
Dim myR As Long
With Worksheets("Standings")
myR = .Range("F" & Rows.Count).End(xlUp)(2).Row
..Range("F" & myR).Formula = "='" & ActiveSheet.Name & "'!M75"
..Range("H" & myR).Formula = "='" & ActiveSheet.Name & "'!D75"
..Range("I" & myR).Formula = "='" & ActiveSheet.Name & "'!F73"
..Range("J" & myR).Formula = "='" & ActiveSheet.Name & "'!H73"
..Range("K" & myR).Formula = "='" & ActiveSheet.Name & "'!J73"
..Range("L" & myR).Formula = "='" & ActiveSheet.Name & "'!L73"
..Range("M" & myR).Formula = "='" & ActiveSheet.Name & "'!M71"
..Range("C" & myR).Formula = "='" & ActiveSheet.Name & "'!B2"
End With
End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Address = "$B$2" Then Sh.Name = Target.Value
End Sub

Macro is - Sheet2.MakeLinks - Macros in: This Workbook

This all works beautifully! My problem is; I have now started a new File
by copying the original for a new Region. This new file does not work. VBA
keeps using file names fom the original and will not post. Everything in the
New File is indentical except names. I DO NOT want the two Files to link to
each other.

Obviously, after I copied the original, VBA will not allow me to use same
VBA. I am getting an Error #400

Can anyone help?

Bob





All times are GMT +1. The time now is 03:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com