Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Wen Wen is offline
external usenet poster
 
Posts: 2
Default Paste doesn't work

Hello,
I'd created the following macro in Thisworkbook. But because of this,
the paste function doesn't work any more.
Can someone help?

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)

[a3:iq5000].Interior.ColorIndex = 0

If Target.Row 2 Then
T = "J" & Target.Row & ":K" & Target.Row
Range(T).Interior.ColorIndex = 6
End If

End Sub

Best Regards
Wen
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Paste doesn't work

A lot of macros kill the Edit|Undo feature. And lots of macros kill the
cutcopymode flag.

Maybe you could have your own version of cut/copy and paste.

Add a "application.enableevents = false" before selecting your "to" range. And
then turn it back on.

But then you'd have to write the equivalent of the Workbook_SheetSelectionChange
code.

And this might not be useful to you, but I could do this:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)

If Application.CutCopyMode < False Then Exit Sub

''''rest of sub
end sub

and then the copy|paste still worked. But that did kill the rest of your sub.

====
And if you're copying while you're developing, you can temporarily suspend the
events by going into the vbe and hitting ctrl-G (to see the immediate window)
and typing:

application.EnableEvents = False
do your development and turn it back on for testing:
application.EnableEvents = True




Wen wrote:

Hello,
I'd created the following macro in Thisworkbook. But because of this,
the paste function doesn't work any more.
Can someone help?

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)

[a3:iq5000].Interior.ColorIndex = 0

If Target.Row 2 Then
T = "J" & Target.Row & ":K" & Target.Row
Range(T).Interior.ColorIndex = 6
End If

End Sub

Best Regards
Wen


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
Wen Wen is offline
external usenet poster
 
Posts: 2
Default Paste doesn't work

Hello Dave,
"If Application.CutCopyMode < False Then Exit Sub" is exact what I'm looking for.
Thank you very much.
The best regards
Wen

Dave Peterson wrote in message ...
A lot of macros kill the Edit|Undo feature. And lots of macros kill the
cutcopymode flag.

Maybe you could have your own version of cut/copy and paste.

Add a "application.enableevents = false" before selecting your "to" range. And
then turn it back on.

But then you'd have to write the equivalent of the Workbook_SheetSelectionChange
code.

And this might not be useful to you, but I could do this:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)

If Application.CutCopyMode < False Then Exit Sub

''''rest of sub
end sub

and then the copy|paste still worked. But that did kill the rest of your sub.

====
And if you're copying while you're developing, you can temporarily suspend the
events by going into the vbe and hitting ctrl-G (to see the immediate window)
and typing:

application.EnableEvents = False
do your development and turn it back on for testing:
application.EnableEvents = True




Wen wrote:

Hello,
I'd created the following macro in Thisworkbook. But because of this,
the paste function doesn't work any more.
Can someone help?

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)

[a3:iq5000].Interior.ColorIndex = 0

If Target.Row 2 Then
T = "J" & Target.Row & ":K" & Target.Row
Range(T).Interior.ColorIndex = 6
End If

End Sub

Best Regards
Wen

Reply
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
What caused my paste function not to work? EXCEL USER Excel Worksheet Functions 2 March 19th 10 10:55 AM
How to paste a bitmap-excel paste doesn't work... Your Display Name here... Excel Discussion (Misc queries) 0 August 27th 09 06:38 PM
PASTE DOESNT WORK robin l Excel Worksheet Functions 9 April 18th 09 06:27 PM
EXCEL PASTE DOES NOT CHANGE DATA - PASTE DOESN'T WORK! robin l Excel Worksheet Functions 7 April 16th 09 07:56 PM
Paste function in Excel doesn't work Bob Reynolds Excel Discussion (Misc queries) 3 January 16th 06 11:52 AM


All times are GMT +1. The time now is 10:44 PM.

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

About Us

"It's about Microsoft Excel"