[FONT=lucida console][COLOR=Royalblue]Sub[/COLOR] a1089462a()
[I][COLOR=seagreen]'https://www.mrexcel.com/forum/excel-questions/1089462-pasted-data-into-notepad-not-aligning-properly.html#post5237042[/COLOR][/I]
[COLOR=Royalblue]Dim[/COLOR] strPath [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]String[/COLOR]: strPath = [COLOR=brown]"D:\zz\try monospace.TXT"[/COLOR] [I][COLOR=seagreen]'Temp file path[/COLOR][/I]
[COLOR=Royalblue]Dim[/COLOR] intFF [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]Integer[/COLOR]: intFF = FreeFile()
[COLOR=Royalblue]Dim[/COLOR] rString [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]String[/COLOR]: rString = [COLOR=brown]""[/COLOR]
[COLOR=Royalblue]Dim[/COLOR] intShow [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]Variant[/COLOR]
[COLOR=Royalblue]Dim[/COLOR] i [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]Long[/COLOR], j [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]Long[/COLOR], x [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]Long[/COLOR]
[COLOR=Royalblue]Dim[/COLOR] va
Open strPath [COLOR=Royalblue]For[/COLOR] Output [COLOR=Royalblue]As[/COLOR] [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=intFF]#intFF[/URL]
myArray = Selection.Value
[COLOR=Royalblue]ReDim[/COLOR] va([COLOR=crimson]1[/COLOR] [COLOR=Royalblue]To[/COLOR] UBound(myArray, [COLOR=crimson]1[/COLOR]), [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]To[/COLOR] [COLOR=crimson]1[/COLOR])
[COLOR=Royalblue]For[/COLOR] j = [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]To[/COLOR] UBound(myArray, [COLOR=crimson]2[/COLOR])
x = [COLOR=crimson]0[/COLOR]
[COLOR=Royalblue]For[/COLOR] i = [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]To[/COLOR] UBound(myArray, [COLOR=crimson]1[/COLOR])
[COLOR=Royalblue]If[/COLOR] x < Len(myArray(i, j)) [COLOR=Royalblue]Then[/COLOR] x = Len(myArray(i, j))
[COLOR=Royalblue]Next[/COLOR]
[COLOR=Royalblue]For[/COLOR] i = [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]To[/COLOR] UBound(myArray, [COLOR=crimson]1[/COLOR])
[COLOR=Royalblue]If[/COLOR] va(i, [COLOR=crimson]1[/COLOR]) = [COLOR=brown]""[/COLOR] [COLOR=Royalblue]Then[/COLOR]
va(i, [COLOR=crimson]1[/COLOR]) = myArray(i, j) & Space(x - Len(myArray(i, j)))
[COLOR=Royalblue]Else[/COLOR]
va(i, [COLOR=crimson]1[/COLOR]) = va(i, [COLOR=crimson]1[/COLOR]) & [COLOR=brown]" "[/COLOR] & myArray(i, j) & Space(x - Len(myArray(i, j)))
[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]If[/COLOR]
[COLOR=Royalblue]Next[/COLOR]
[COLOR=Royalblue]Next[/COLOR]
[COLOR=Royalblue]For[/COLOR] i = [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]To[/COLOR] UBound(va, [COLOR=crimson]1[/COLOR])
Print [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=intFF]#intFF[/URL] , va(i, 1)
rString = [COLOR=brown]""[/COLOR]
[COLOR=Royalblue]Next[/COLOR]
Close [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=intFF]#intFF[/URL]
intShow = Shell([COLOR=brown]"Notepad.exe "[/COLOR] & strPath, vbNormalFocus)
[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]Sub[/COLOR][/FONT]