Adding columns using VBA

rexel12

Board Regular
Joined
Feb 19, 2002
Messages
86
I have a spreadsheet which imports a CSV file. I have setup a macro to import and format the CSV correctly. However what I need is to be able to find the first blank cell at the bottom of each column of data and total the entire column. If I use the macro recorder it gives me a fixed range i.e A2:A256. Unfortunately the CSV file differs in size every month and the VBA code should cope with this.

TIA

Rex.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Just a little FYI that people don't seem to think of: put your totals at the top.
 
Upvote 0
On 2002-02-20 07:17, Juan Pablo G. wrote:
This should get you started.

Sub MySum()
Range("A65536").End(xlUp).Offset(1).FormulaR1C1 = "SUM(R2C:R[-1]C)"
End Sub

This should read

Sub MySum()
Range("A65536").End(xlUp).Offset(1).FormulaR1C1 = "=SUM(R2C:R[-1]C)"
End Sub

PLEASE, NO PRIVATE MESSAGES, ANSWER TO THE FORUM.

_________________
Regards,

Juan Pablo G.
MrExcel.com Consulting
This message was edited by Juan Pablo G. on 2002-02-20 08:57
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top