How do you copy, paste and transpose from a horizontal range to a vertical one in VBA

lidiev

New Member
Joined
Dec 20, 2018
Messages
4
ABCDEFG
MovieLog-Line
In the wake of an alien attack that has crippled most of the world, shock has turned to resolve as the survivors gather to fight back. Leading the charge is Boston history professor Tom Mason, whose wife was killed in the attack, and one of his three sons is among a group of captive teens. Desperate to rescue his son, Tom joins forces with the 2nd Massachusetts, a makeshift regiment assigned to protect the survivors. As second in command to Weaver, Tom uses his knowledge of military history to gain intelligence about the aliens and form a plan of attack. But the plan keeps changing and more questions surface as the survivors discover what they're really up against: a highly intelligent, heavily armed alien force whose purpose on Earth is the biggest mystery of all.In the wake of an alien attack that has crippled most of the world, shock has turned to resolve as the survivors gather to fight back Leading the charge is Boston history professor Tom Mason, whose wife was killed in the attack, and one of his three sons is among a group of captive teens Desperate to rescue his son, Tom joins forces with the 2nd Massachusetts, a makeshift regiment assigned to protect the survivors As second in command to Weaver, Tom uses his knowledge of military history to gain intelligence about the aliens and form a plan of attack But the plan keeps changing and more questions surface as the survivors discover what they're really up against: a highly intelligent, heavily armed alien force whose purpose on Earth is the biggest mystery of all
A team of explorers made up of soldiers and scientists travels through a Stargate, an ancient portal to other planets. They use the Stargate to explore new worlds, forge ties with friendly civilizations and protect Earth from hostile forces. A team of explorers made up of soldiers and scientists travels through a Stargate, an ancient portal to other planets They use the Stargate to explore new worlds, forge ties with friendly civilizations and protect Earth from hostile forces

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]
[TD="align: center"]The Dark Knight[/TD]

[TD="align: center"]3[/TD]
[TD="align: center"]Stargate SG-1[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Movies


This is my first time posting, here is an example of what I'm trying to achieve.

I split the entries in column b into to the other entires, but I can't figure out how to copy the split entries from the other columnes "C: to the last column" and paste / transpose in a separate worksheet called MovieList in column A in a loop and also to skip any same entries and go to the next space if the entries are new.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
I think this macro will do what you want; HOWEVER, it will fail to work correctly for any Log-Line containing an abbreviation (a shortened "word" ending in a period space such as "Blah blah Dr. Strange blah blah.") as there is no way the code can decide that an abbreviation is not the end of a sentence unless you included in the code a list of all the possible abbreviation that could possibly occur.
Code:
Sub SplitLogLine()
  Dim Cell As Range, Sentences() As String
  For Each Cell In Range("B2", Cells(Rows.Count, "B").End(xlUp))
    Sentences = Split(Cell.Value, ". ")
    With Cell.Offset(, 1).Resize(, UBound(Sentences) + 1)
      .Value = Sentences
      .WrapText = True
    End With
  Next
End Sub
 
Last edited:
Upvote 0
Thanks Rick Rothstein but I have the macro for that to split the sentences. What I need is to paste those split sentences in a separate sheet called movie list in a transpose manner doing down in Column A and also detecting if each entry is not same in the column. All of that done in a loop, I've tried doing a for each loop and a for loop with no luck
 
Upvote 0
Cross posted https://www.ozgrid.com/forum/forum/...m-a-horizontal-range-to-a-vertical-one-in-vba

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,023
Latest member
alabaz

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