LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Rows to Col Macro Question

Hello,

I found and borrowed this macro from Dave Peterson. It works, but i need to
add in a couple of things to make my life that one bit easier.

I need to run this over a number of sheets so need the code to do that, and
call the new sheets "Sheet Name" Reform.

Also, I have a date in B2 (that chages as you go down the rows) that has to
go next to each of the indivdual time in the column.

So i need ;
B C D E......AA
14-Oct 01:23 06:21 06:58

To turn into (in a new sheet)
A B
14-Oct 01:23
14-Oct 06:21
14-Oct 06:58

This code puts the times in the order i need but just in column A, and i
need to include the dates.

I need some VBA hlep.

Thanks in advance

Sub rowstocol()

Dim wks As Worksheet
Dim colnos As Long
Dim CopytoSheet As Worksheet

If ActiveSheet.Name = "A2" Then
MsgBox "Active Sheet Not Valid" & Chr(13) _
& "Try Another Worksheet."
Exit Sub
Else
Set wks = ActiveSheet
Application.ScreenUpdating = False
For Each Wksht In Worksheets
With Wksht
If .Name = "A2" Then
Application.DisplayAlerts = False
Sheets("A2").Delete
End If
End With
Next
Application.DisplayAlerts = True
Set CopytoSheet = Worksheets.Add
CopytoSheet.Name = "A2"
wks.Activate
Range("C1").Select
colnos = InputBox("Enter Number of Columns to Transpose to Rows")

Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
With ActiveCell
.Resize(1, colnos).Copy
End With
Sheets("A2").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, _
SkipBlanks:=False _
, Transpose:=True
Application.CutCopyMode = False
ActiveSheet.Cells(Rows.Count, ActiveCell.Column).End(xlUp).Select
ActiveCell.Offset(1, 0).Select 'note: changed from 2 to 1
' Selection.EntireRow.Insert 'note: I have remmed out this line
wks.Activate
ActiveCell.Select
Loop


Sheets("A2").Activate
End If
End Sub

 
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
Macro code to hide rows and not calculate hidden rows bradmcq Excel Discussion (Misc queries) 0 September 1st 09 12:38 AM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Links and Linking in Excel 1 November 13th 08 08:44 AM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Excel Worksheet Functions 1 November 12th 08 01:39 PM
Delete Duplicate Rows Macro Question elfmajesty Excel Discussion (Misc queries) 1 June 17th 06 01:12 AM
Quick Macro question - How to delete two rows then skip one - and repeat David Smithz Excel Discussion (Misc queries) 3 March 3rd 06 02:58 PM


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