B
Brian
I am wanting to add a single clickable button inside of a cell on a worksheet
that automatically runs a macro. I have never created a button inside a
sheet and am still new to VBA. What is the best way to go about this?
Here's the Macro
Sub CopyTrackStatsValuesforSorting()
'
'COPIES THE Track Stats WORKSHEET TO A NEW WORKBOOK WHERE IT CAN BE SORTED
'WITHOUT SCREWING UP THE CELL FORMULAS
'MAKES THE Races WORKSHEET ACTIVE
Worksheets("Track Stats").Select
'SELECTS THE APPROPRIATE CELLS TO COPY
Rows("2:65536").Select
Selection.Copy
'ADDS A NEW WORKBOOK WITH NEW SHEET NAME
Workbooks.Add
ActiveSheet.Name = "Sortable Track Stats"
'COPIES ONLY SPECIFIC FORMATS & NUMBERS
With Worksheets("Sortable Track Stats").Range("A2:IV65536")
.PasteSpecial xlPasteValuesAndNumberFormats
.PasteSpecial xlFormats
.PasteSpecial xlPasteColumnWidths
End With
'UNPROTECTS NEW SHEET & DELETES FIRST DROPDOWN ROW
Rows("1:1").Select
ActiveSheet.Unprotect
Selection.delete Shift:=xlUp
End Sub
that automatically runs a macro. I have never created a button inside a
sheet and am still new to VBA. What is the best way to go about this?
Here's the Macro
Sub CopyTrackStatsValuesforSorting()
'
'COPIES THE Track Stats WORKSHEET TO A NEW WORKBOOK WHERE IT CAN BE SORTED
'WITHOUT SCREWING UP THE CELL FORMULAS
'MAKES THE Races WORKSHEET ACTIVE
Worksheets("Track Stats").Select
'SELECTS THE APPROPRIATE CELLS TO COPY
Rows("2:65536").Select
Selection.Copy
'ADDS A NEW WORKBOOK WITH NEW SHEET NAME
Workbooks.Add
ActiveSheet.Name = "Sortable Track Stats"
'COPIES ONLY SPECIFIC FORMATS & NUMBERS
With Worksheets("Sortable Track Stats").Range("A2:IV65536")
.PasteSpecial xlPasteValuesAndNumberFormats
.PasteSpecial xlFormats
.PasteSpecial xlPasteColumnWidths
End With
'UNPROTECTS NEW SHEET & DELETES FIRST DROPDOWN ROW
Rows("1:1").Select
ActiveSheet.Unprotect
Selection.delete Shift:=xlUp
End Sub