LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default copy ???

Hi all,
I'm not really sure if those 2 code examples are exactly what I wanted to do
but after some touble I found a solution that works for me:

Const RowNum = 64
Const ColNum = 96
Const DataStartCell = "B2"

Private Sub CommandButton1_Click()


CopyColumn "Sheet1", "Sheet1", "A79"
CopyColumn "Sheet2", "Sheet1", "B79"

End Sub

Sub CopyColumn(SourceSheetname As String, DestSheetname As String, DestRange
As String)

Dim i As Integer

For i = 1 To ColNum

Worksheets(SourceSheetname).Range(DataStartCell).O ffset(0, i -
1).Resize(RowNum, 1).Copy _
Destination:=Worksheets(DestSheetname).Range(DestR ange).Offset((i - 1) *
RowNum, 0)

Next i
End Sub


I'm not really into VBA but compared to the 2 examples I think this is
easier to understand. But again I'm not really a VBA crack. If you have any
suggestion why this would be a bad or sloppy solution please tell me.
Thanks
Andy
"Patrick Molloy" wrote:

Here's a simple vba UDF for you
Function One_column(source As Range)
Dim output As Variant
Dim cell As Range
Dim index As Long
ReDim output(1 To source.Count)
For Each cell In source.Cells
index = index + 1
output(index) = cell.Value
Next
One_column = WorksheetFunction.Transpose(output)
End Function

to use it, select a column for output, the array enter the formula

eg, data table may range named MyData
select a column long enough for the output and type
=One_Column(mydata)
hold down shft+ctrl then press Enter to enter the formula as an array formula






"bandy2000" wrote:

HI

I have a 64 X 96 field with data and want to bring the 96 columns in one
column so that column Nr1s 64 entries are followed by column Nr2s entries. Is
that possible from another worksheet, too?

Thanks
ANDY

 
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
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM
How copy format, font, color and border without copy/paste? Michel[_3_] Excel Programming 1 November 5th 03 04:43 PM


All times are GMT +1. The time now is 02:55 AM.

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"