Hi,
I come with a question involving excel VBA since I am no longer sure how I should proceed with this on Excel 2010.
Right now I have :
1. a summary table that is summed from 2 different single cell columns
2. they come from different month worksheet (12 in total)
3. currently, there are 2 ranges I need summed up to be displayed in the Summary sheet
3. they will stay in same cell range even on different worksheets as i use VBA to extract them to a set range of cells
4. a dropdown table with the months listed and a cell link to return the Month in Admin sheet
Sample of the cell range:
Company A (cell range = B7 to L40)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Current Month[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Actual[/TD]
[TD]Budget[/TD]
[TD]2013[/TD]
[/TR]
[TR]
[TD]Revenue[/TD]
[TD]800[/TD]
[TD]600[/TD]
[TD]4000[/TD]
[/TR]
[TR]
[TD]Gross Profit[/TD]
[TD]800[/TD]
[TD]600[/TD]
[TD]4000[/TD]
[/TR]
[TR]
[TD]COS[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]
Company B (cell range = P7 to Z40)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Current Month[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Actual[/TD]
[TD]Budget[/TD]
[TD]2013[/TD]
[/TR]
[TR]
[TD]Revenue[/TD]
[TD]1200[/TD]
[TD]3600[/TD]
[TD]12000[/TD]
[/TR]
[TR]
[TD]Gross Profit[/TD]
[TD]1200[/TD]
[TD]3600[/TD]
[TD]12000[/TD]
[/TR]
[TR]
[TD]COS[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]
My question is this:
1. Can i use an array or any other method other than hardcode everything for when the month changes via combobox to get the =SUM(January!B7+January!P7), =SUM(February!B7+February!P7) from a range of B7+P7 up until L40+Z40? This is a B7 + P7, B8 + P8, C7 + Q7 ..... L40 + Z40.
Something like
Code is incomplete because i don't really know how to proceed but is it possible for something along those lines? My programming is very rusty so I would very much appreciate it if someone could point me on the right track.
Many thanks in advance,
Dhork.
I come with a question involving excel VBA since I am no longer sure how I should proceed with this on Excel 2010.
Right now I have :
1. a summary table that is summed from 2 different single cell columns
2. they come from different month worksheet (12 in total)
3. currently, there are 2 ranges I need summed up to be displayed in the Summary sheet
3. they will stay in same cell range even on different worksheets as i use VBA to extract them to a set range of cells
4. a dropdown table with the months listed and a cell link to return the Month in Admin sheet
Sample of the cell range:
Company A (cell range = B7 to L40)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Current Month[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Actual[/TD]
[TD]Budget[/TD]
[TD]2013[/TD]
[/TR]
[TR]
[TD]Revenue[/TD]
[TD]800[/TD]
[TD]600[/TD]
[TD]4000[/TD]
[/TR]
[TR]
[TD]Gross Profit[/TD]
[TD]800[/TD]
[TD]600[/TD]
[TD]4000[/TD]
[/TR]
[TR]
[TD]COS[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]
Company B (cell range = P7 to Z40)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Current Month[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Actual[/TD]
[TD]Budget[/TD]
[TD]2013[/TD]
[/TR]
[TR]
[TD]Revenue[/TD]
[TD]1200[/TD]
[TD]3600[/TD]
[TD]12000[/TD]
[/TR]
[TR]
[TD]Gross Profit[/TD]
[TD]1200[/TD]
[TD]3600[/TD]
[TD]12000[/TD]
[/TR]
[TR]
[TD]COS[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]
My question is this:
1. Can i use an array or any other method other than hardcode everything for when the month changes via combobox to get the =SUM(January!B7+January!P7), =SUM(February!B7+February!P7) from a range of B7+P7 up until L40+Z40? This is a B7 + P7, B8 + P8, C7 + Q7 ..... L40 + Z40.
Something like
Code:
If Admin!C3 = 1 Then
Arr = Sum(January!B7 + January!P7)
ElseIf Admin!C3 = 2 Then
Arr = Sum(February!B7 + February!P7)
ElseIf Admin!C3 = 2 Then
Arr = Sum(March!B7 + March!P7)
Code is incomplete because i don't really know how to proceed but is it possible for something along those lines? My programming is very rusty so I would very much appreciate it if someone could point me on the right track.
Many thanks in advance,
Dhork.