Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 30th, 2008, 05:25 AM
Registered User
 
Join Date: Jul 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default vba question on adding certain columns

I have something to do in visual basic and apparently I dont know how to do it:(. So I need a bit of a help. I have two sheets in excel: Sheet 1 and Sheet 2
In Sheet1 I have something like
            2008 2009 2008
Name1 10 20 30 40 50 60 20 10 15 20 40 60
Name2 60 20 40 70 70 20 30 10 25 35 70 90
Name3 50 20 30 10 50 20 10 30 50 30 40 50
....

I dont know how many years I have. I can have 4,5, etc

In the Sheet2 I will have to have something like

            2008 2009
Name1 25 40 70 100 50 60 20 10
Name2 85 55 110 160 70 20 30 10
Name3 100 50 70 60 50 20 10 30
....

Meaning, if I have the same year multiple times, I add the values (in the ex: I add first column from the first 2008 with the first column from the second 2008 and so on) and if I have just one year then I just have to copy it as it is in Sheet2.

I was thinking to define a name in excel on the same row where I have the years and using offset in vba (I know the exact position of the years) to see if I have more times the same years. I even did that (kind off) but I cant seem to make it for several years and for several columns.

I could really use some help so if you can... help!! :)
Thank you!

Csilla









Similar Threads
Thread Thread Starter Forum Replies Last Post
Using VBA to Sort Multiple Columns meclive Excel VBA 1 July 30th, 2008 11:04 AM
Adding columns to Gridview gagansharma7 ADO.NET 1 February 15th, 2008 10:54 AM
problem adding two columns g_vamsi_krish SQL Server 2000 2 March 6th, 2006 10:56 AM
adding columns to matrix [email protected] BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 May 4th, 2005 07:05 AM
Adding optional columns? shaileshmark SQL Server 2000 9 July 24th, 2004 03:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.