View Single Post
  #7  
Old March 16th, 2010, 03:36 AM posted to microsoft.public.excel.worksheet.functions
L. Howard Kittle
external usenet poster
 
Posts: 516
Default Need transpose? help....

Thanks Bob.

Your advice rings familiar and I appreciate the reminder from an MVP to a
hobby lurker.

So it has to be a Long because the possible 'scope' of the value of i or j,
given the code, may exceed the value of an Integer?

Regards,
Howard


"Bob Phillips" wrote in message
...
Howard,

They should be Longs.

Yes, you should always dimension your variables, you can always get caught
out with mis-spellings if you don't. I always do in my own code, I just
miss them sometimes in posts, especially if responding to someone who
doesn't do so.

--

HTH

Bob

"L. Howard Kittle" wrote in message
...
Hi Bob,

I tested your 'lil sonnet and it works fine with Option Explicit edited
out. Then I dimmed LastRow and LastCol as Range and that was fine, but
errored out at i and j, I tried Integer and Range and neither worked.
What would these be declared as??

Is there any good reason to dim these variables? Seems I hear you always
should.

Thanks
Howard

"Bob Phillips" wrote in message
...
Off the top, untested

With ActiveSheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
For i = LastRow To 1 Step -1

For j = LastCol To 2 Step -1

.Rows(i + 1).Insert
.Cells(i, j).Cut .Cells(i + 1, "A")
Next j
Next i
End With


--

HTH

Bob

"Jethro Bodeene" Jethro wrote in
message ...
I have a spreadsheet with 151 columns by 49 rows of data. I need to
transpose this data from its current state, to only 1 vertical column.
How
can I do this? Thks