LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 563
Default Need help creating macros

Hi,
This is not very sophisticated but seems to work with the data you provided.

Sub tryme()
LastRow = Cells(Rows.Count, "A").End(xlUp).Row

For j = 1 To LastRow
LastCol = Cells(j, Columns.Count).End(xlToLeft).Column
If LastCol < 7 Then
Range(Cells(j + 1, 1), Cells(j + 1, 10)).Copy Destination:=Cells(j, 5)
Cells(j + 1, "A") = "VOID"
LastCol = Cells(j, Columns.Count).End(xlToLeft).Column
For k = LastCol To 1 Step -1
If IsEmpty(Cells(j, k)) Then
Cells(j, k).Delete Shift:=xlToLeft
End If
Next k
End If
Next j

'delete marked rows
For j = LastRow To 1 Step -1
If Cells(j, "A") = "VOID" Then
Rows(j).EntireRow.Delete
End If
Next j

best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme

"Atom Oaks" wrote in message
...
Sorry, I did not realize that the format changed after I posted. This is
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 find and combine all the duplicate rows in Column A so
that my work sheet 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, 10)).Select
Selection.Cut
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(-1, 0).Select
Selection.EntireRow.Delete
End Sub

It does the job, but requires that I manually locate the duplicates and
use
a hotkey. So any ideas would be greatly appreciated. Hopefully this post
is
much better. Thank you!

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating macros garygc Excel Discussion (Misc queries) 1 February 5th 09 11:24 PM
Creating macros with if stmts Lisa12 Excel Discussion (Misc queries) 3 July 15th 08 11:38 AM
macros creating NSNR Excel Discussion (Misc queries) 2 October 26th 07 08:19 AM
creating excel macros Dick Excel Worksheet Functions 0 June 2nd 06 06:56 PM
Macros-creating new sheets Bonbon Excel Worksheet Functions 3 February 17th 06 09:44 AM


All times are GMT +1. The time now is 07:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"