Stuck on vba reference

dshafique

Board Regular
Joined
Jun 19, 2017
Messages
171
Hey guys, I'm stuck on a part of the macros I'm creating. Im trying to create a table(table2), and the values in it are referenced from a table above(table1).
however, table1 is dynamic, a new column is added every two weeks.

in table2, the first set of values are the same as the last column in table 1. normally i would write something like
Code:
=AQ4
however, I cant do just AQ4 cause every couple weeks, the cell column will change.

1.) how can i reference the cell in the second row of the last column dynamically?

another issue is, that my manager sent me an example of how it should look like after running the macro.
in his headers in table2, he has specific names like week of August 21 or week of august 14.
The values in those cells need to be the sum of all columns from table 1 which fall within that range.

for example, the headers in table 1 are random, such as 8/14, 8/15, 8/17. so in the cells under the headers for Week of august 14, i need it to have the values from table 1 with the headers that fall within the week of the header.

2.) how do I reference specific cells which fall within a date range in the headers.
3.) i need to also make new headers with the same naming format as the weeks increase. week of september 25, etc


I know its pretty confusing. but If anyone wants to see screenshots, I can email them to you, same with the files. (i dont know how to add pictures to this forum).

any resolve would be greatly appreciated. thanks!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Table headers have to be static names; you can't use formulas in the table headers. What you might be able to do is to create the table without (or with a header but hide that line) headers and then use a line above the table with a formula to show what you want the header to look like. I think this will be more difficult though since you are adding columns and the label above the new column would have to be added manually, although I'm sure you could automate this with some coding.

https://answers.microsoft.com/en-us...a/9bf5db8b-9673-e011-8dfc-68b599b31bf5?auth=1
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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