S
slunk
I'm new to VBA coding in Excel and am trying to figure out how to do
this, but I am running lost.
Each month I will have a workbook containing various worksheets, each
worksheet representing an individual account. The worksheets will be
named by account number, like '123456'. I will then import a worksheet
titled 'ocd 123456'. I need to create some code that recognizes the
'ocd 123456' worksheet and adds certain values together to copy to
cells in the '123456' worksheet. There may be 10+ account numbers in
each workbook, corresponding to an equal number of imported 'ocd
######' worksheets in the same workbook.
The 'ocd 123456' worksheet will have a variable amount of rows
depending on account and that month's transactions. The 'ocd 123456'
worksheet will have two columns, column A with a three-digit object
number followed by the corresponding object title and column B
containing a monetary value. Additionally, a single cell in '123456'
will likely need the sum of various object code values from multiple
rows of 'ocd 123456'.
For example:
Cell C22 in '123456' should equal the sum of object codes 901-927 but
not 921 (or 901-920 & 922-927). Each month will likely not have all of
the these object codes, just a few.
123456
Code:
--------------------
A B C
20
21
22 Equipment Purchases =(sum of object codes 901-920 & 922-927 from 'ocd 123456')
23
24
--------------------
ocd 123456
Code:
--------------------
A B
1 001 - Salary 8,000
2 023 - Copies 20
3 901 - Laser Printers 50
4 908 - Light Bulbs 75
5 921 - Overhead 100
6 927 - Staplers 20
--------------------
Therefore, C22 in '123456' should equal 145 (50+75+20).
I would geatly appreciate any help with this or any links or
recommendations of books that may help me along the way.
Thanks,
Collin
this, but I am running lost.
Each month I will have a workbook containing various worksheets, each
worksheet representing an individual account. The worksheets will be
named by account number, like '123456'. I will then import a worksheet
titled 'ocd 123456'. I need to create some code that recognizes the
'ocd 123456' worksheet and adds certain values together to copy to
cells in the '123456' worksheet. There may be 10+ account numbers in
each workbook, corresponding to an equal number of imported 'ocd
######' worksheets in the same workbook.
The 'ocd 123456' worksheet will have a variable amount of rows
depending on account and that month's transactions. The 'ocd 123456'
worksheet will have two columns, column A with a three-digit object
number followed by the corresponding object title and column B
containing a monetary value. Additionally, a single cell in '123456'
will likely need the sum of various object code values from multiple
rows of 'ocd 123456'.
For example:
Cell C22 in '123456' should equal the sum of object codes 901-927 but
not 921 (or 901-920 & 922-927). Each month will likely not have all of
the these object codes, just a few.
123456
Code:
--------------------
A B C
20
21
22 Equipment Purchases =(sum of object codes 901-920 & 922-927 from 'ocd 123456')
23
24
--------------------
ocd 123456
Code:
--------------------
A B
1 001 - Salary 8,000
2 023 - Copies 20
3 901 - Laser Printers 50
4 908 - Light Bulbs 75
5 921 - Overhead 100
6 927 - Staplers 20
--------------------
Therefore, C22 in '123456' should equal 145 (50+75+20).
I would geatly appreciate any help with this or any links or
recommendations of books that may help me along the way.
Thanks,
Collin