LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 187
Default how do I display data in rows?

Copy the data, select a cell where to paste, go to Edit - paste special -
transpose

"Sam" wrote:

Thanks very much! This works great!!

Sam

"Toppers" wrote:

This VBA module will transpose from Sheet1 to Sheet2 and assumes data starts
in row 1. Change this and sheet names as required.

Code should be inserted into general module

Alt+F11 to open Visual Baic Eitor (VBE)
Right click on w/book in project window and do Insert==Module
Copy and paste code
Place cursor in code and use F8 to step through code line by line (only for
testing!)

OR

Click green "arrow" button (Run macro) on the standard toolbar in VBE

HTH


Sub Transpose()

Dim ws1 As Worksheet, ws2 As Worksheet
Dim lastrow As Long, row As Long, oRow As Long

Set ws1 = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")

With ws1
lastrow = .Cells(Rows.Count, "A").End(xlUp).row
row = 1 '<== start row input data
oRow = 1 '<== start row of output data
Set rnga = .Range("a1:a" & lastrow)
Do
n = Application.CountIf(rnga, .Cells(row, "A"))
ws2.Cells(oRow, "A") = .Cells(row, "A")
.Cells(row, "B").Resize(n, 1).Copy
ws2.Cells(oRow, "B").PasteSpecial Paste:=xlPasteAll,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
row = row + n
oRow = oRow + 1
Loop Until row lastrow
End With
End Sub

"Sam" wrote:

I want to take an Excel database and display the data in rows across the
sheet. For example, from:

A 1
A 3
A 4
B 2
B 3

I want to produce:

A 1 3 4
B 2 3

with each of these in a separate cell across the row. Is there a way to do
it? Thanks ...

 
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
Ignoring Rows When Extracting Data From One Worksheet To Another Jim J. Excel Worksheet Functions 2 May 8th 06 04:55 PM
Display Row of Data as Form/Page Tim Nicholson Excel Discussion (Misc queries) 3 April 4th 06 06:19 PM
ranking query JaimeTimbrell Excel Discussion (Misc queries) 2 February 16th 06 08:09 AM
From several workbooks onto one excel worksheet steve Excel Discussion (Misc queries) 6 December 1st 05 08:03 AM
Removing blank rows in a worksheet Louise Excel Worksheet Functions 6 May 26th 05 02:21 PM


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