Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Transposing | Excel Discussion (Misc queries) | |||
Transposing | Excel Worksheet Functions | |||
TRANSPOSING | Excel Discussion (Misc queries) | |||
macro for transposing data | Excel Discussion (Misc queries) | |||
Macro: Row transposing; event on open vs. shortcut key | Excel Programming |