Transpose Macro - Struggling with Arrays

Tash Point O

New Member
Joined
Feb 12, 2018
Messages
47
Hello -

I made a jenky macro that transposes a large set of data. It runs slow because it's a lot of data that it goes through. So I had the bright idea that I wanted to spend 2 days in a row improving this dumb macro I made. I really tried making this an array or a range type macro and keep failing. Can a transpose macro even be array'ed/range'd? :(

I want to take the values starting in D1 and say through P1 (because it will vary) and transpose them in the C column under that first value you see (for instance take D1:E1 and move it under c1), then hit the next value in D and do the same, till there no longer is a value in D.

I hate to keep asking for help here and I really tried, but I'm new to declaring dimensions and arrays and I'm ready for a beer at this point. Thank you for any input and insights. I am buying VBA for Dummies after work today.

2r5ugjo.jpg
[/IMG]
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I can't relate your description to your example. How about a before and after?
 
Upvote 0
Maybe ...

Code:
Sub TPO()
  Dim rArea         As Range

  On Error GoTo NeverMind
  
  For Each rArea In Range("E:E").SpecialCells(xlCellTypeConstants).Areas
    With Range(rArea(1), Cells(rArea.Row, Columns.Count).End(xlToLeft))
      .Copy
      .Offset(1, -1)(1).PasteSpecial Transpose:=True
      .ClearContents
    End With
  Next rArea
  
NeverMind:
End Sub
 
Upvote 0
SHG,

That worked PERFECTLY. Thank you so much!!! I always credit in my macros who helped me, so your name is going in it, if you don't mind!
 
Upvote 0
No need to do so at all. You're welcome.
 
Upvote 0
Maybe ...

Code:
Sub TPO()
  Dim rArea         As Range

  On Error GoTo NeverMind
  
  For Each rArea In [B][COLOR="#FF0000"]Range("E:E")[/COLOR][/B].SpecialCells(xlCellTypeConstants).Areas
    With Range(rArea(1), Cells(rArea.Row, Columns.Count).End(xlToLeft))
      .Copy
      .Offset(1, -1)(1).PasteSpecial Transpose:=True
      .ClearContents
    End With
  Next rArea
  
NeverMind:
End Sub
:confused: Why Column E instead of Column D?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top