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

Tom,

Great. A big help.

Thanks,
Alan

--
achidsey


"Tom Ogilvy" wrote:

Sub CopyNumbers()

Set rngA = Range(Range("A2"),Range("A2").End(xldown))
Set rngB = rngA.Offset(0,1)

Sheets("Second").Activate

Cells.Find(What:="Price1").Offset(1).Select
Selection.Resize(rngA.rows.count,1).Value = rngA.Value

Cells.Find(What:="Price2").Offset(1).Select
Selection.Resize(rngB.rows.count,1).Value = rngB.Value

End Sub

--
Regards,
Tom Ogilvy

"achidsey" (notmorespam) wrote in message
...
Excel Experts,

I want to copy several columns of numbers from one spreadsheet to another.
I want to save each column of numbers as a separate variable and then go

to
the other sheet, and paste each of them. I'd prefer not to copy and paste
the columns one by one because of the extra code and time to switch back

and
forth between the sheets.

My spreadsheets and code are similar to the following

FIRST SHEET SECOND SHEET
A B A B C

1 Price1 Price2
2 10.25 50.50
3 20.25 60.50
4 30.25 70.50

Sub CopyNumbers()

Set rngA = Range("A2:A4")
Set rngB = Range("B2:B4")

Sheets("Second").Activate

Cells.Find(What:="Price1").Offset(1).Select
Selection.Value = rngA.Value

Cells.Find(What:="Price2").Offset(1).Select
Selection.Value = rngB.Value

End Sub


The problem with this code is that only the first value in the range is
copied to the new spreadsheet. For example, under Price1, only 10.25 is
entered. I recognize that if I increased the size of the selection in the
targe sheet to 3 cells, all three values would be entered. However, the
column of numbers is of a different size each time so I don't know how

large
to make the selection.

Do I have to select the correct size range in the target sheet for this to
work, or is there another way to make this work?

Thanks,
Alan

--
achidsey




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
copying columns oldjay Excel Discussion (Misc queries) 3 December 3rd 09 11:56 PM
Copying across columns Gemz Excel Worksheet Functions 2 February 27th 08 03:06 PM
copying data down columns juliejg1 Excel Worksheet Functions 4 August 20th 07 08:37 PM
Copying to columns [email protected] Excel Discussion (Misc queries) 4 October 17th 06 06:19 PM
copying columns Deb B. Excel Discussion (Misc queries) 2 November 28th 04 07:55 PM


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