Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default adding columns

I am trying to build a summary page for a bunch of
worksheets. Each sheet in the workbook is a for a
different company. I want to take information out of one
of those columns and cut it and paste it on the summary
page. Then I want to take the numbers input and get an
average for it in the last column.

Thanks,

David
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default adding columns

Not sure how your data is laid out, but this might help.

Option Explicit
Sub testme01()

Dim newWks As Worksheet
Dim wks As Worksheet
Dim iCtr As Long
Dim ColToReturn As Long
Dim dummyRng As Range

Set newWks = Worksheets.Add

ColToReturn = 5

iCtr = 2 'start in B and put averages in column A
For Each wks In ActiveWorkbook.Worksheets
If wks.Name = newWks.Name Then
'do nothing
Else
wks.Columns(ColToReturn).Copy _
Destination:=newWks.Cells(1, iCtr)
iCtr = iCtr + 1
End If
Next wks

With newWks
.Name = "AVG_" & Format(Now, "yyyymmdd_hhmmss")
Set dummyRng = .UsedRange 'try to reset last cell
.Range("a1:a" & .Cells.SpecialCells(xlCellTypeLastCell).Row).Formu la _
= "=average(b1:iv1)"
End With

End Sub

I stuck the average into column A. (I think it's easier to find that way.)

david wrote:

I am trying to build a summary page for a bunch of
worksheets. Each sheet in the workbook is a for a
different company. I want to take information out of one
of those columns and cut it and paste it on the summary
page. Then I want to take the numbers input and get an
average for it in the last column.

Thanks,

David


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding two Columns Gr8 Dane[_2_] Excel Discussion (Misc queries) 0 February 10th 09 09:10 AM
I need help adding columns Tash New Users to Excel 1 January 20th 09 09:31 PM
Adding Columns, Then deleting old columns May Excel Discussion (Misc queries) 4 October 30th 08 04:44 PM
adding 2 columns where Tammy Excel Discussion (Misc queries) 4 June 15th 08 08:35 PM
Adding Columns bstafford Excel Discussion (Misc queries) 1 October 9th 05 05:04 AM


All times are GMT +1. The time now is 08:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"