#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Help on Macros

Hi,

I have a file with huge data. I would like to insert a column before a
column with heading "8010" and the new column which is been inserted should
contain the sum of all datas to its left..
Assuming column BX is the "8010"( At BX2) column i would like to insert a
new column at BW and it should contain sum of datas from B2 to BW2


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Help on Macros

It could easily be done in a macro but even easier with a formula

1) Manually add a column before column BX by highlight column BX by clicking
on BX at the top of the column. then right click mouse and select Insert

2) in cell BX2 put the following formula

=if(BY2=8010,sum(B2:BW2),"")

3) Copy the formula down column BX.

"Yuvaraj" wrote:

Hi,

I have a file with huge data. I would like to insert a column before a
column with heading "8010" and the new column which is been inserted should
contain the sum of all datas to its left..
Assuming column BX is the "8010"( At BX2) column i would like to insert a
new column at BW and it should contain sum of datas from B2 to BW2


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Help on Macros

But there are many such columns. and i do it on a daily basis... I thought
if i could write a macro, i dont have to type the formulas again and again...


"Joel" wrote:

It could easily be done in a macro but even easier with a formula

1) Manually add a column before column BX by highlight column BX by clicking
on BX at the top of the column. then right click mouse and select Insert

2) in cell BX2 put the following formula

=if(BY2=8010,sum(B2:BW2),"")

3) Copy the formula down column BX.

"Yuvaraj" wrote:

Hi,

I have a file with huge data. I would like to insert a column before a
column with heading "8010" and the new column which is been inserted should
contain the sum of all datas to its left..
Assuming column BX is the "8010"( At BX2) column i would like to insert a
new column at BW and it should contain sum of datas from B2 to BW2


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Help on Macros

Good answer. If yo are repeating operations over and over again then you
should use macros.

Sub SumAllData()

'Insert Column
With ActiveSheet
.Columns("BX").Insert
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
.Range("BX2").Formula = "=if(BY2=8010,SUM(B2:BW2),"""")"
.Range("BX2").Copy Destination:=.Range("BX3:BX" & LastRow)
End With
End Sub

"Yuvaraj" wrote:

But there are many such columns. and i do it on a daily basis... I thought
if i could write a macro, i dont have to type the formulas again and again...


"Joel" wrote:

It could easily be done in a macro but even easier with a formula

1) Manually add a column before column BX by highlight column BX by clicking
on BX at the top of the column. then right click mouse and select Insert

2) in cell BX2 put the following formula

=if(BY2=8010,sum(B2:BW2),"")

3) Copy the formula down column BX.

"Yuvaraj" wrote:

Hi,

I have a file with huge data. I would like to insert a column before a
column with heading "8010" and the new column which is been inserted should
contain the sum of all datas to its left..
Assuming column BX is the "8010"( At BX2) column i would like to insert a
new column at BW and it should contain sum of datas from B2 to BW2


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Help on Macros

Thanks Joel... It solves the issue for today... but each day the '8010'
appears in various coulmns... its not BX always... is there a way where in
the macro can search for 8010 and automatically insert a column before it...

Thanks in advance...


"Joel" wrote:

Good answer. If yo are repeating operations over and over again then you
should use macros.

Sub SumAllData()

'Insert Column
With ActiveSheet
.Columns("BX").Insert
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
.Range("BX2").Formula = "=if(BY2=8010,SUM(B2:BW2),"""")"
.Range("BX2").Copy Destination:=.Range("BX3:BX" & LastRow)
End With
End Sub

"Yuvaraj" wrote:

But there are many such columns. and i do it on a daily basis... I thought
if i could write a macro, i dont have to type the formulas again and again...


"Joel" wrote:

It could easily be done in a macro but even easier with a formula

1) Manually add a column before column BX by highlight column BX by clicking
on BX at the top of the column. then right click mouse and select Insert

2) in cell BX2 put the following formula

=if(BY2=8010,sum(B2:BW2),"")

3) Copy the formula down column BX.

"Yuvaraj" wrote:

Hi,

I have a file with huge data. I would like to insert a column before a
column with heading "8010" and the new column which is been inserted should
contain the sum of all datas to its left..
Assuming column BX is the "8010"( At BX2) column i would like to insert a
new column at BW and it should contain sum of datas from B2 to BW2


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
Macros: can you copy macros from one doc to another? Roady Excel Discussion (Misc queries) 1 June 12th 08 05:47 PM
Excel 2007 macros - how to merge 5 macros together into one Sue Excel Discussion (Misc queries) 1 April 16th 08 08:36 PM
Macros warning always shows up, even if all macros removed Joe M Excel Discussion (Misc queries) 1 December 20th 07 04:45 AM
Macros - copying macros from one computer to another TT Excel Discussion (Misc queries) 18 December 14th 06 03:24 AM
Training: More on how to use macros in Excel: Recording Macros ToriT Excel Worksheet Functions 2 February 10th 06 07:05 PM


All times are GMT +1. The time now is 06:59 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"