Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding new columns from one sheet to another


Hi all,

I am trying to code a macro that uses a for each loop, for each cell in
say Row B going down, B2:B20 create a new column for each cell on
another sheet, with the same header... So basically taking everything
from a vertical set of rows and populating another sheet with all
columns (horizontal) instead...

If anyone has any ideas, please right back.

Thanks.

Hugh.


--
hughvision
------------------------------------------------------------------------
hughvision's Profile: http://www.excelforum.com/member.php...o&userid=24660
View this thread: http://www.excelforum.com/showthread...hreadid=382389

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Adding new columns from one sheet to another

did you try to <transpose

highlight B2 to B20
edit copy
open anoher sheet and select a cell
edit pastespecial -transpose

is that not what you want.
==================
hughvision wrote
in message ...

Hi all,

I am trying to code a macro that uses a for each loop, for each cell in
say Row B going down, B2:B20 create a new column for each cell on
another sheet, with the same header... So basically taking everything
from a vertical set of rows and populating another sheet with all
columns (horizontal) instead...

If anyone has any ideas, please right back.

Thanks.

Hugh.


--
hughvision
------------------------------------------------------------------------
hughvision's Profile:

http://www.excelforum.com/member.php...o&userid=24660
View this thread: http://www.excelforum.com/showthread...hreadid=382389



  #3   Report Post  
Posted to microsoft.public.excel.programming
FGM FGM is offline
external usenet poster
 
Posts: 35
Default Adding new columns from one sheet to another

Here is part of a macro I use to get specified cells and transpose them to
another sheet.


'Get Records This loops through and picks up each group of CEL records and
'transposes it on the main wksht

Sheets("raw").Select
Rcount = Range("B25").Value 'Gets the number of CEL records
x = 1 'set starting loop count
R1 = 5 'set starting NewRange first position
R2 = 16 'set starting NewRange second position
R3 = 5 'set SendRange position
NewRange = "T5:T16" 'for first loop
SendRange = "E5" 'for first loop
dbRangeGet = "U5" ' for first loop Meas dBA data
dbRangeSend = "R5" 'for first loop Meas dBA data
Do Until x Rcount 'until it loops the number of record count
'this gets the data that needs to be transposed
Sheets("raw").Select
Range(NewRange).Select
Selection.Copy
Sheets("main").Select
Range(SendRange).Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=True
'this gets the single cell that needs to be copied Meas dBA
Sheets("raw").Select
Range(dbRangeGet).Select
Selection.Copy
Sheets("main").Select
Range(dbRangeSend).Select
ActiveSheet.Paste
'The following increments the variables for the next group of records
R1 = R1 + 15 'increment 15 for the next record
R2 = R2 + 15 'increment 15 for the next record
R3 = R3 + 1 'increment 1 for the next record
NewRange = "T" & R1 & ":" & "T" & R2 ' appends the needed info for
the NewRange
SendRange = "E" & R3 'appends the needed info for the SendRange
dbRangeGet = "U" & R1 'appends the needed info for the dbRangeGet
dbRangeSend = "R" & R3 'appends the need info for the dbRangeSend
the Meas dBA
x = x + 1 'increments the count for the loop
Loop



"hughvision" wrote:


Hi all,

I am trying to code a macro that uses a for each loop, for each cell in
say Row B going down, B2:B20 create a new column for each cell on
another sheet, with the same header... So basically taking everything
from a vertical set of rows and populating another sheet with all
columns (horizontal) instead...

If anyone has any ideas, please right back.

Thanks.

Hugh.


--
hughvision
------------------------------------------------------------------------
hughvision's Profile: http://www.excelforum.com/member.php...o&userid=24660
View this thread: http://www.excelforum.com/showthread...hreadid=382389


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
Adding Columns, Then deleting old columns May Excel Discussion (Misc queries) 4 October 30th 08 04:44 PM
How to make columns in one sheet match columns from another sheet Zoe Hu Excel Discussion (Misc queries) 5 December 4th 07 06:53 PM
VBA to stop XL from adding the Path Sring to Sheet-to-Sheet Links [email protected] Excel Discussion (Misc queries) 5 August 18th 06 01:46 PM
adding new columns sheet with external data John New Users to Excel 0 September 23rd 05 08:00 PM
adding data from one sheet to another sheet as a dropdown list bo. gatorguy Excel Discussion (Misc queries) 1 February 18th 05 10:51 PM


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