#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Appending columns

I have an application that exports a stream of data to Excel. Each time the
program runs it append to the previous run in column A. The data for each
subset takes up the same amount of rows as the previous. Example; the first
group of data will occupy cells A1 thru 10 and the second group A11 thru A20.
I want the second group to occupy B1 thru B10. In stead of cutting and
pasting is there a macro or function that will do this with only changing a
few parameters? Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 52
Default Appending columns

It appears that your application keeps track of the last row where data was
entered, and enters the next batch at Ax, where x is lastrow+1. You need
change the application to keep track of the last COLUMN where data was
entered, and enter the next batch at X1, where X is lastcolumn+1. This will
be easier to do if you switch to R1C1 referencing.

If you cannot change the application, then after running the app you would
have to manually move the new data from wherever it was written in Col. A to
the next empty column.
--
TedMi

"Ben Vann" wrote:

I have an application that exports a stream of data to Excel. Each time the
program runs it append to the previous run in column A. The data for each
subset takes up the same amount of rows as the previous. Example; the first
group of data will occupy cells A1 thru 10 and the second group A11 thru A20.
I want the second group to occupy B1 thru B10. In stead of cutting and
pasting is there a macro or function that will do this with only changing a
few parameters? Thanks for your help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Appending columns

Unfortunatly I cannot change the application. I was hoping for code that
would do it automatically if changed the number of rows in a group.

"tedmi" wrote:

It appears that your application keeps track of the last row where data was
entered, and enters the next batch at Ax, where x is lastrow+1. You need
change the application to keep track of the last COLUMN where data was
entered, and enter the next batch at X1, where X is lastcolumn+1. This will
be easier to do if you switch to R1C1 referencing.

If you cannot change the application, then after running the app you would
have to manually move the new data from wherever it was written in Col. A to
the next empty column.
--
TedMi

"Ben Vann" wrote:

I have an application that exports a stream of data to Excel. Each time the
program runs it append to the previous run in column A. The data for each
subset takes up the same amount of rows as the previous. Example; the first
group of data will occupy cells A1 thru 10 and the second group A11 thru A20.
I want the second group to occupy B1 thru B10. In stead of cutting and
pasting is there a macro or function that will do this with only changing a
few parameters? Thanks for your help.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Appending columns

Don't know how/when the data gets into A11:A20 so can't suggest which type
of event code to use.

A macro would be as so........

Sub Move_Data()
Dim rng1 As Range
Dim rng2 As Range
With ActiveSheet
Set rng1 = .Range("A11:A20")
Set rng2 = .Cells(1, Columns.Count).End(xlToLeft).Offset(0, 1)
rng1.Copy Destination:=rng2
End With
End Sub

Run whenever you want.

If you have more details on the import operation perhaps the macro could be
event-driven.


Gord Dibben MS Excel MVP

On Thu, 25 Sep 2008 12:28:26 -0700, Ben Vann <Ben
wrote:

I have an application that exports a stream of data to Excel. Each time the
program runs it append to the previous run in column A. The data for each
subset takes up the same amount of rows as the previous. Example; the first
group of data will occupy cells A1 thru 10 and the second group A11 thru A20.
I want the second group to occupy B1 thru B10. In stead of cutting and
pasting is there a macro or function that will do this with only changing a
few parameters? Thanks for your help.


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Appending columns

Thanks Gord; Maybe this will help. I operate a Mitutoyo coordinate measuring
machine that can export the measurement results to Excel. Each time I run the
program it opens the file and appends the data to the last time it ran. If
the results were 25 rows long and I had four groups of data (4 parts), how
would that look in the code you supplied? Could it be deleted and shifted up
so the next group would be moved? Could there be input via a dialog box that
asked for number of rows and number of parts?

"Gord Dibben" wrote:

Don't know how/when the data gets into A11:A20 so can't suggest which type
of event code to use.

A macro would be as so........

Sub Move_Data()
Dim rng1 As Range
Dim rng2 As Range
With ActiveSheet
Set rng1 = .Range("A11:A20")
Set rng2 = .Cells(1, Columns.Count).End(xlToLeft).Offset(0, 1)
rng1.Copy Destination:=rng2
End With
End Sub

Run whenever you want.

If you have more details on the import operation perhaps the macro could be
event-driven.


Gord Dibben MS Excel MVP

On Thu, 25 Sep 2008 12:28:26 -0700, Ben Vann <Ben
wrote:

I have an application that exports a stream of data to Excel. Each time the
program runs it append to the previous run in column A. The data for each
subset takes up the same amount of rows as the previous. Example; the first
group of data will occupy cells A1 thru 10 and the second group A11 thru A20.
I want the second group to occupy B1 thru B10. In stead of cutting and
pasting is there a macro or function that will do this with only changing a
few parameters? Thanks for your help.





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Appending columns

Ben

Assume you have a blank worksheet.

On first run yoyo could pass any number of rows to column A........right?

This number would not change on subsequent runs...........right?

On second yoyo run it could pass any number of rows again to column
A........right?

I guess you could store the number of rows from first run and subtract that
from total rows after second run so's you would know how many second run
rows to move to next empty column.

Same for subsequent runs.

I don't understand the 4 groups and where they would be moved to.

Yes..........you could have an input box that requested how many rows but
not sure where the "parts" comes in.


Gord


On Thu, 25 Sep 2008 15:35:01 -0700, Ben Vann
wrote:

Thanks Gord; Maybe this will help. I operate a Mitutoyo coordinate measuring
machine that can export the measurement results to Excel. Each time I run the
program it opens the file and appends the data to the last time it ran. If
the results were 25 rows long and I had four groups of data (4 parts), how
would that look in the code you supplied? Could it be deleted and shifted up
so the next group would be moved? Could there be input via a dialog box that
asked for number of rows and number of parts?

"Gord Dibben" wrote:

Don't know how/when the data gets into A11:A20 so can't suggest which type
of event code to use.

A macro would be as so........

Sub Move_Data()
Dim rng1 As Range
Dim rng2 As Range
With ActiveSheet
Set rng1 = .Range("A11:A20")
Set rng2 = .Cells(1, Columns.Count).End(xlToLeft).Offset(0, 1)
rng1.Copy Destination:=rng2
End With
End Sub

Run whenever you want.

If you have more details on the import operation perhaps the macro could be
event-driven.


Gord Dibben MS Excel MVP

On Thu, 25 Sep 2008 12:28:26 -0700, Ben Vann <Ben
wrote:

I have an application that exports a stream of data to Excel. Each time the
program runs it append to the previous run in column A. The data for each
subset takes up the same amount of rows as the previous. Example; the first
group of data will occupy cells A1 thru 10 and the second group A11 thru A20.
I want the second group to occupy B1 thru B10. In stead of cutting and
pasting is there a macro or function that will do this with only changing a
few parameters? Thanks for your help.




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
Combining data from two columns into one - appending new values tothe end of one column Jason[_11_] Excel Worksheet Functions 4 April 4th 08 10:13 PM
Appending columns or calculation to pivot tables John Excel Discussion (Misc queries) 1 June 15th 07 10:07 AM
Appending Text Jamen McGranahan Excel Discussion (Misc queries) 2 September 11th 06 11:10 PM
Appending worksheets Guillermo Scharffenorth New Users to Excel 1 March 7th 06 12:48 AM
Appending a second csv file Rick Excel Discussion (Misc queries) 3 March 9th 05 06:21 PM


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

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

About Us

"It's about Microsoft Excel"