I currently have data that I am splitting into multiple sheets and allowing the user to select which sheet they run the macro on. The work sheet is used as a filtration between multiple systems
I have a named range (dayList) that groups the data into days, and creates a new sheet for each day (day1, day2, etc). Each sheet must then have another macro applied (screen data) that will filter the data in each of these sheets in exactly the same way.
I am trying to create a UI that will approximate the user being able to click on one of the cells in the named range to run the macro for that particular day. The code snippet im currently working with is below.
Sheets("LaunchScreen").Activate
Cells(rowCounter, 6).Value = "Day" & dayCounter
ActiveSheet.Buttons.Add(538.5, 56.25, 48.75, 13.5).Name = "Day" & dayCounter
ActiveSheet.Buttons("Day" & dayCounter).Select
Selection.OnAction = "JoinTransactionAndFMMS"
Im looping this to create a new button for each day then pass the button name to another macro as a parameter to find the worksheet in this workbook that shares the same name.
TLDR: I need to:
- Set the location of a button using VBA, preferably matching location to a cell reference e.g.
Range("A1").Button.Insert
- Pass a cell reference from a named range into a macro
An excel noob in way over his head here. Any help would be greatly appreciated!
ActiveSheet.Buttons.Add(Range("B1").Top, Range("A1").Left, 48.75, 13.5).Text = "B1"
would place a button in the very top left of the screen (A1) and:ActiveSheet.Buttons.Add(Range("C5").Top, Range("C5").Left, 48.75, 13.5).Text = "C5"
places a button halfway between row 7 and 8, and left of center between columns B and c. Though passing parameters bit works like a charm. – BiGXERO May 10 '12 at 05:04