LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Help with Transposing Macro

This is a bit neater and the message box doesn't serve any purpose:

Sub TransposeRange()

Dim arr
Dim lCR As Long
Dim lCC As Long
Dim UB1 As Long
Dim UB2 As Long

If Selection.Cells.Count = 1 Then
Exit Sub
End If

lCR = Selection.Cells(1).Row
lCC = Selection.Cells(1).Column

arr = Selection

UB1 = UBound(arr)
UB2 = UBound(arr, 2)

Selection.ClearContents

arr = WorksheetFunction.Transpose(arr)

With Range(Selection.Cells(1), _
Cells(lCR + UB2 - 1, lCC + UB1 - 1))
.Value = arr
.Select
End With

End Sub


RBS


"unknowndevice"
wrote in message
news:unknowndevice.1ue3me_1125090326.6003@excelfor um-nospam.com...

Dnereb & RB Smissaert:


Dnereb: I dont know how to code. I get an error at this line:

Cells(TargetRow, TargetColumn) = Cells(SourceRow, SourceColumn).Text

What am I supposed to put in any of these fields?


RB Smissaert:

Run time error '9' subscript out of range

Any ideas?


--
unknowndevice
------------------------------------------------------------------------
unknowndevice's Profile:
http://www.excelforum.com/member.php...o&userid=26646
View this thread: http://www.excelforum.com/showthread...hreadid=399497


 
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
Transposing Nanapat Excel Discussion (Misc queries) 2 April 2nd 08 11:38 PM
Transposing Deena Excel Worksheet Functions 2 October 27th 06 05:13 PM
TRANSPOSING GARY Excel Discussion (Misc queries) 1 March 17th 06 11:09 AM
macro for transposing data [email protected] Excel Discussion (Misc queries) 1 January 4th 06 08:14 PM
Macro: Row transposing; event on open vs. shortcut key Eric Schneider Excel Programming 2 September 15th 04 07:46 PM


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