How to write an Excel VBA Script which generates a SUMIFS table using a user selected column as an input in the formula?

aranjan

New Member
Joined
Oct 17, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi guys, not sure if this is even possible but I'm just curious. I know you can make VBA automatically populate a formula in certain cells in Excel, and also that you can insert columns and such next to a user selected cell. Is it possible however to write a code in which the user selects a column that contains data 1 (dates for example), and then selects a column with data 2 (names for example) and a final column with data 3 (dollar values). Then the code would run on a predefined range (a table that has names as row headers and dates as column headers) and populate a SUMIFS formula into all the cells- with the user selected columns as the criteria range and the defined name rows and date columns as the criteria.

If someone can point me on the right direction I'd greatly appreciate this. I'm struggling to figure out how to structure this macro so that a user input variable can be used inside the SUMIFS formula, changing the criteria range in the formula based on what the user selects. Let me know if this even seems possible in VBA.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top