
Originally Posted by
Norie
How did you create the buttons?
If it's a Forms button you could use something like this.
Dim rng As Range
Dim btn As Shape
Set btn = Worksheets("Sheet1").Shapes(Application.Caller)
Set rng = Worksheets("Sheet1").Cells(btn.TopLeftCell.Row, 1)
Mind you having hundreds of buttons might not be a good idea.
Here is the whole button. And yes, it is a forms button.
Sub CreateSheet()
Dim sPath As String, sSheetName As String
sSheetName = ActiveSheet.Name
sPath = ThisWorkbook.Path & "\" & Sheets(ActiveSheet.Name).Range("A3").Value
Workbooks.Add ("\\twsbs01\common$\TIMBERWORKS JOB FILES\CURRENT JOBS\CONSTRUCTION RELEASE DATABASE\CRE TEMPLATES\cre template.xlsm")
ActiveWorkbook.SaveAs sPath, 52
Range("C2:F2").FormulaR1C1 = "='[cre database.xlsm]" & sSheetName & "'!R1C2"
Range("C3:F3").FormulaR1C1 = "='[cre database.xlsm]" & sSheetName & "'!R1C5"
End Sub
Edit Post... I guess I'm just not sure how to incorporate what you suggested into what I've written so far. :/
Thank you for taking your time to help me out.
Bookmarks