Macros


Posted by Brad on January 28, 2002 8:11 AM

I have a macro that takes data from a master sheet and places it in correct sheets all with in the same workbook. How do I get the macro to highlight what information it has copied off the master sheet into the other woorksheet so I can see if any inforamtion did not get copied over?

Posted by Keiser on January 28, 2002 8:51 AM

Would this help?

add this code after the paste action in your code.

With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With

So it colors it. Anyway, the color can be of your choice. :)

Hope this is something you can use.



Posted by Brad on January 28, 2002 10:53 AM

Ok, I am missing something obvious. Below is my code and I tried to put your piece in it after the paste function. Although that worked, it doesn't highlite the master report, but rather the individual tab. I think it really needs to come just after the "copy" functions, but it doesn't work when I put it there.

Appreciate the help.

Brad

Public Sub CopyRows()
Sheets("Master Report").Select
' Find the last row of data
FinalRow = Range("A65536").End(xlUp).Row
' Loop through each row
For x = 2 To FinalRow
' Decide if to copy based on column D
ThisValue = Range("D" & x).Value
If ThisValue = "Brownstown PC" Then
Range("A" & x & ":E" & x).Copy
Sheets("Brown").Select
NextRow = Range("A65536").End(xlUp).Row + 1
Range("A" & NextRow).Select
ActiveSheet.Paste
Sheets("Master Report").Select
End If
Next x
End Sub