hello
i have a code that searches column B for data entered in textbox, when the data is located it highlights active row yellow, i then added the following code so that when i changed from highlighted row the row changed back to no fill. it worked but now i can not cut and paste within the sheet? can this be fixed.
Code:Private Sub Worksheet_SelectionChange(ByVal Target As Range) Range("$B:$I").Interior.ColorIndex = xlNone Intersect(Target.EntireRow, Range("$B:$I")).Interior.ColorIndex = xlNone Range("B5:I5").Interior.ColorIndex = 34 Range("B9:I9").Interior.ColorIndex = 35 End Sub
Last edited by rylo; 07-31-2009 at 12:17 AM. Reason: Added Code Tags
Hello waltron,
Welcome to the Forum!
What lead you to believe this routine is causing the problem?
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
g'day Leith
when i removed the above mentioned code i could cut and paste. i have another code (posted below) that also stops working when this code is active. i get a run time error "1004" "paste method of worksheet failed" i can't put my finger on it?
Cheers.Code:Sub addjob() Rows("7:7").Select Selection.Copy Rows("102:102").Select ActiveSheet.Paste Rows("11:102").Select Application.CutCopyMode = False Selection.Sort Key1:=Range("C11"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Rows("7:7").Select Selection.ClearContents Range("B7").Select ActiveWorkbook.save End Sub
Last edited by Leith Ross; 07-31-2009 at 02:27 AM.
Hello waltron,
I don't know why your workbook is all buggered up but give this a try.
Code:Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim Rng As Range Range("$B:$I").Interior.ColorIndex = xlNone Set Rng = Intersect(Target.EntireRow, Range("$B:$I")) If Not Rng Is Nothing Then Rng.Interior.ColorIndex = xlNone Range("B5:I5").Interior.ColorIndex = 34 Range("B9:I9").Interior.ColorIndex = 35 End If End Sub
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
morning,
Good 1 leith it seems to have fixed my issue, thanks for your help I'm still learning this whole VBA caper. Much appreciated.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks