PDA

View Full Version : VBA to Concatenate Variable Range



leopard
10-24-2012, 06:12 AM
Dear All,
I have a problem with a worksheet that my company accounting system exports every month.

Attached : sample of the worksheet.

In column ( F ) , I need a macro to do the following calculations:
1- Check for the Title – if it begins with "Cost Center"
2- Check for the Title – if it begins with "Account Code"
3- Detect the Range Start just below "Account Code" , and End with the row above "Total"
4- Concatenate the string written in each row of the range with the string in "Cost Center"

The Story is:
Each Month I've this worksheet with hundreds of Cost Centers and subsidiary Account Codes, And to be able to analyze the accounts efficiently I need to concatenate both Cost Centers & Account Codes manually ( as you see coloring sample in the attached file ).
Which led to wasting many hours , and high risk of error while copying and pasting formulas.

Your help on this matter will be highly appreciated.
Best Regards.

Aflatoon
10-24-2012, 06:23 AM
Cross-posted here (http://www.ozgrid.com/forum/showthread.php?t=171177) for info. And here (http://www.mrexcel.com/forum/excel-questions/665873-visual-basic-applications-concatenate-variable-range.html).

leopard
10-24-2012, 06:41 AM
Hi Aflaton;

I've posted there too. Is this against the forum rules?

Aflatoon
10-24-2012, 06:55 AM
No - if you read the rules it says that you just have to provide links to your cross-posts. Otherwise we could be spending time here trying to solve it when it's already been solved here (http://www.excelforum.com/excel-programming-vba-macros/870866-vba-to-concatenate-variable-range.html). ;)