View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Need help creating macros

I think you will need to give us just a little more information about how
your data is structured if you want a complete solution (remember, you know
all about how your data is arranged and we here have no idea about it
whatsoever... all we know is what you tell us). Here are some of the
questions I have...

1. Will the first occurrence of a color always be repeated 4 times as all
your example data shows?

2. Will a second row for a repeated color (in the first column) always have
three blank cells following the color as your example data shows? If not,
then will there always be at least one blank cell following the second
mention of the color in the first column?

3. Can there be more than two rows for a given color repeated in the first
column (that is, in your example, could the be another row starting with the
color Purple in addition to the two you already show)?

4. Will all the mulit-row colors (shown in the first column) be grouped next
to each other as your example shows, or could they be scattered all about
with other colors in-between them?

--
Rick (MVP - Excel)


"Atom Oaks" wrote in message
...
Oops, I did not notice that format had changed after I posted. This is an
example of how my worksheet looks:

Purple Purple Purple Purple*
Purple //////// //////// //////// Green Green Green*
Blue Blue Blue Blue Red Red Red*
Yellow Yellow Yellow Yellow*
Yellow //////// //////// //////// Orange Orange Orange*
Brown Brown Brown Brown Teal Teal Teal*
Black Black Black Black Grey Grey Grey*

//////// = 1 blank cell
* = end of row

And I am trying to locate and combine all of the duplicate rows in Column
A
so that my worksheet looks like this:

Purple Purple Purple Purple Green Green Green*
Blue Blue Blue Blue Red Red Red*
Yellow Yellow Yellow Yellow Orange Orange Orange*
Brown Brown Brown Brown Teal Teal Teal*
Black Black Black Black Grey Grey Grey*

So far, this is what I have come up with:

Sub CombineDelete()
'
' Macro2 Macro
' Macro recorded 1/8/2010 by Information Systems
'
' Keyboard Shortcut: Ctrl+q
'
Range(ActiveCell, ActiveCell.Offset(0, 3)).Select
Selection.Cut
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(-1, 0).Select
Selection.EntireRow.Delete
End Sub

It does what I intended but requires that I manually locate the duplicates
in Column A. So any ideas would be greatly appreciated. Hopefully, this
post is a lot better. Sorry!