Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Copy Cells from columns to rows

I need A1:A3 then A4:A6 then A7:A8 copied to Row ?(1,3), row ? (1,3), row ? (1,3) depending on the row heading, then delete cell color and Print sheet: Can anyone help with some generic code for me Please!!! ie.
A1
A2 2.
A3 $1.5
A4
A5
A6 $3.0
A7
A8
A9 $4.5

Family Type Pounds Pric
C A 2.5 $1.5
P B 2 $3.0
M C 4 $4.50
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Copy Cells from columns to rows



Sub Test()
Dim v
v = ListToTable([a1].currentregion, 3)
[a1].currentregion.clear
[a1].Resize(UBound(v, 1), UBound(v, 2)) = v
End Sub

Function ListToTable(oriTable As Range, numFields As Integer)
Dim newTable As Variant, r As Long, c As Integer
ReDim newTable(1 To (1 + oriTable.Rows.Count \ numFields), 1 To
numFields)
For r = 1 To oriTable.Rows.Count Step numFields
For c = 1 To numFields
newTable(1 + r \ numFields, c) = oriTable(r + c - 1, 1)
Next
Next
ListToTable = newTable
End Function


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"?B?U2tpcGM=?=" wrote:

I need A1:A3 then A4:A6 then A7:A8 copied to Row ?(1,3), row ? (1,3),
row ? (1,3) depending on the row heading, then delete cell color and
Print sheet: Can anyone help with some generic code for me Please!!!
ie. A1 A
A2 2.5
A3 $1.50
A4 B
A5 2
A6 $3.00
A7 C
A8 4
A9 $4.50

Family Type Pounds Price
C A 2.5 $1.50
P B 2 $3.00
M C 4 $4.50


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Copy Cells from columns to rows

Thanks Keep: I left out that this has to happen from sheet1 into sheet2 sorry. Where would that go in the code

SkipC
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Copy Cells from columns to rows


well... i did put it in a function...
try:

Sub Test2()
Dim v
v = ListToTable([sheet1!a1].currentregion, 3)
[sheet2!a1].Resize(UBound(v, 1), UBound(v, 2)) = v
End Sub



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"?B?U2tpcGM=?=" wrote:

Thanks Keep: I left out that this has to happen from sheet1 into
sheet2 sorry. Where would that go in the code?

SkipC


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Copy Cells from columns to rows

Thanks Cool: Yoou've been a great help

Skipc
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
Can't Copy/Cut Cells, Rows or Columns Pete Excel Discussion (Misc queries) 1 September 9th 07 05:18 AM
copy cells from columns to rows Libby Excel Discussion (Misc queries) 4 August 27th 07 08:08 PM
copy formulas to cells absolute rows and variable columns Mark Excel Discussion (Misc queries) 1 January 30th 06 10:15 PM
Copy Data to Rows instead of Columns Donnie Stone Excel Programming 0 September 17th 03 11:10 PM
Copy Data to Rows instead of Columns Donnie Stone Excel Programming 1 September 16th 03 03:08 AM


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