Sounds like the worksheet is protected.
Sounds like the worksheet is protected.
I have narrowed it down to the following bit of code!
![]()
Private Sub Worksheet_SelectionChange(ByVal Target As Range) For Each cell In Range("F5:F1000") If cell > "" Then cell.EntireRow.Interior.ColorIndex = 6 Else cell.EntireRow.Interior.ColorIndex = xlNone End If Next cell End Sub
If (cell.EntireRow.Interior.ColorIndex = 6) and ('cell.EntireRow.Interior.ColorIndex = xlNone) are removed, then Paste works!
Can anyone tell me what is going on and how to fix it?
Here iis an example
sample4.zip
Last edited by VBA Noob; 11-09-2007 at 12:54 PM.
You forgot to tell us there was code in the workbook?
Sorry about that!Originally Posted by shg
It's in the Distimport sheet!
Hello lushl0sn,
I downloaded your workbook to see what the problem was. I changed your macro some , and moved it into the Worksheet_Change(ByVal Target As Range) event procedure. Everything works. Paste will be grayed out whenever the clipboard is empty. Here is the macro I used. I am running Office 2003 on Windows XP.
Sincerely,![]()
Private Sub Worksheet_Change(ByVal Target As Range) With Target If .Row >= 5 And .Row <= 1000 Then If Cells(.Row, "F") <> "" Then .EntireRow.Interior.ColorIndex = 6 Else .EntireRow.Interior.ColorIndex = xlNone End If End If End With End Sub
Leith Ross
Couldn't those event routines be substituted by Conditional Formatting? Or is there some other routine that checks for cell color?
Thanks so much for the help Leith and mikerickson!
I've got a lot to learn about Excel Programming so my technique might not be the best!
Conditional formatting may be a better option.
Can anyone tell me why paste is disabled in the SelectionChange event and not the change event after the following code is executed?
![]()
cell.EntireRow.Interior.ColorIndex = 6"
Last edited by VBA Noob; 11-11-2007 at 11:06 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks