Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-20-2008, 10:15 AM
shiro
 
Posts: n/a
macro for repeat task and format interior

Hi All,
I'm trying to check out repeated value on column Q and the hightlighted
entire cell on the left.I put the code that found from Sample,and trying
to modified it but I made a mistake.I can't select entire cell on the left,
I just can highlight 2 cell ( offset(0.-3) and the cell on column A).Please
help how to select entire cell to the left without interupted by blank cell.

And also I want to put the copy of higlighted cell value to a new workbook.

Thank's.

Rgds,


Shiro


Sub Duplicate_Serial_Number()

Dim eX As Integer
Dim cell_in_loop As Range

eX = ActiveSheet.Evaluate("COUNTIF(Q:Q,"">1"")")

If eX = 0 Then
MsgBox "There is no duplicated serial number ", vbExclamation _
+ vbOKOnly, "No Duplicated Data"
Else
For Each cell_in_loop In Range("Q16:Q50000")
If cell_in_loop.Value > 1 And _
cell_in_loop.Value <> "" Then
With cell_in_loop.Offset(0, -3).End(xlToLeft).Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If
Next
End If
End Sub



Reply With Quote
  #2 (permalink)  
Old 05-20-2008, 12:37 PM
Dave Peterson
 
Posts: n/a
Re: macro for repeat task and format interior

One way:

Option Explicit
Sub Duplicate_Serial_Number()

Dim myCell As Range
Dim LastRow As Long
Dim myRng As Range
Dim myRngToShade As Range

With ActiveSheet
'clean up any previous shading
.Cells.Interior.ColorIndex = xlNone
LastRow = .Cells(.Rows.Count, "Q").End(xlUp).Row
Set myRng = .Range("Q16:Q" & LastRow)

If Application.Max(myRng) < 2 Then
MsgBox "There is no duplicated serial number ", vbExclamation _
+ vbOKOnly, "No Duplicated Data"
Else
For Each myCell In myRng.Cells
If myCell.Value > 1 Then
Set myRngToShade = .Range(.Cells(myCell.Row, "A"), _
.Cells(myCell.Row, "N"))
With myRngToShade.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If
Next myCell
End If
End With

End Sub

=======
Colors are pretty, but I like to use that extra column (Q) and then use
data|Filter|autofilter to see the duplicates.



shiro wrote:
>
> Hi All,
> I'm trying to check out repeated value on column Q and the hightlighted
> entire cell on the left.I put the code that found from Sample,and trying
> to modified it but I made a mistake.I can't select entire cell on the left,
> I just can highlight 2 cell ( offset(0.-3) and the cell on column A).Please
> help how to select entire cell to the left without interupted by blank cell.
>
> And also I want to put the copy of higlighted cell value to a new workbook.
>
> Thank's.
>
> Rgds,
>
> Shiro
>
> Sub Duplicate_Serial_Number()
>
> Dim eX As Integer
> Dim cell_in_loop As Range
>
> eX = ActiveSheet.Evaluate("COUNTIF(Q:Q,"">1"")")
>
> If eX = 0 Then
> MsgBox "There is no duplicated serial number ", vbExclamation _
> + vbOKOnly, "No Duplicated Data"
> Else
> For Each cell_in_loop In Range("Q16:Q50000")
> If cell_in_loop.Value > 1 And _
> cell_in_loop.Value <> "" Then
> With cell_in_loop.Offset(0, -3).End(xlToLeft).Interior
> .ColorIndex = 6
> .Pattern = xlSolid
> End With
> End If
> Next
> End If
> End Sub


--

Dave Peterson
Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



All times are GMT. The time now is 04:05 AM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Wedding Flower Bouquet | Car Accident Lawyer Los Angeles | Free Advertising | Cheap Magazines | Credit Cards



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114