ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help me please with pivot script (Dave Peterson) (https://www.excelbanter.com/excel-programming/351707-help-me-please-pivot-script-dave-peterson.html)

Danny Boy via OfficeKB.com

Help me please with pivot script (Dave Peterson)
 
Hi Dave

Thanks for your response,

I'm sure that there is nothing wrong with your script but it won't work on my
workbook. Please ignore my first 2 posts. I have now changed my mined and
want to do it from the format below

I have 2 Columns will this style info:

Batman CAPER
Batman CLOWN
Batman FAIRY
Robin SIDEKICK
Robin PONSE
Robin PETAPAN



I would like a macro to output:

Batman CAPER CLOWN FAIRY
Robin SIDEKICK PONSE FAIRY

Please note that all the data will be different but it will only be two
columns.

P.S.

I also know that this can be done by pivot table. But unfortunatly, this is
not the way I want to do it.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200601/1

Bob Phillips[_6_]

Help me please with pivot script (Dave Peterson)
 
Sub Reformat()
Dim iLastrow As Long
Dim i As Long
Dim rng As Range

iLastrow = Cells(Rows.Count, "A").End(xlUp).Row
For i = iLastrow To 2 Step -1
If Cells(i, "A").Value = Cells(i - 1, "A").Value Then
Cells(i - 1, "C").Resize(, 200).Value = Cells(i, "B").Resize(,
200).Value
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
End If
Next i

If Not rng Is Nothing Then rng.Delete

End Sub


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Danny Boy via OfficeKB.com" <u15117@uwe wrote in message
news:5b06d18347b22@uwe...
Hi Dave

Thanks for your response,

I'm sure that there is nothing wrong with your script but it won't work on

my
workbook. Please ignore my first 2 posts. I have now changed my mined and
want to do it from the format below

I have 2 Columns will this style info:

Batman CAPER
Batman CLOWN
Batman FAIRY
Robin SIDEKICK
Robin PONSE
Robin PETAPAN



I would like a macro to output:

Batman CAPER CLOWN FAIRY
Robin SIDEKICK PONSE FAIRY

Please note that all the data will be different but it will only be two
columns.

P.S.

I also know that this can be done by pivot table. But unfortunatly, this

is
not the way I want to do it.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200601/1




Dave Peterson

Help me please with pivot script (Dave Peterson)
 
And you have another reply at your other post.

"Danny Boy via OfficeKB.com" wrote:

Hi Dave

Thanks for your response,

I'm sure that there is nothing wrong with your script but it won't work on my
workbook. Please ignore my first 2 posts. I have now changed my mined and
want to do it from the format below

I have 2 Columns will this style info:

Batman CAPER
Batman CLOWN
Batman FAIRY
Robin SIDEKICK
Robin PONSE
Robin PETAPAN

I would like a macro to output:

Batman CAPER CLOWN FAIRY
Robin SIDEKICK PONSE FAIRY

Please note that all the data will be different but it will only be two
columns.

P.S.

I also know that this can be done by pivot table. But unfortunatly, this is
not the way I want to do it.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200601/1


--

Dave Peterson

Danny Boy via OfficeKB.com

Help me please with pivot script (Dave Peterson)
 
Thanks alot Dave and Bob

I have managed to do what I wanted

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200601/1


All times are GMT +1. The time now is 01:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com