#1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 6
Default Copy code

Is there a way I can copy code across multiple worksheets without having to
open each worksheet code page and individually paste the code in.
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,124
Default Copy code

More detail and code?
Maybe have a look in the ThisWorkbook module

--
Don Guillett
SalesAid Software

"Hamster07" wrote in message
...
Is there a way I can copy code across multiple worksheets without having
to
open each worksheet code page and individually paste the code in.



  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 6
Default Copy code

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As _
Boolean)
Const WS_RANGE As String = "G2:G22"
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
For Each cell In Target
If Target.Interior.ColorIndex = 5 Then
Target.Interior.ColorIndex = xlNone
Else
Target.Interior.ColorIndex = 5
End If
Next
Cancel = True
End If
End Sub

Don,
Thanks for the reply.
The above code is to re-colour the selected cells when double clicked. I
have 77 worksheets and its a bit laborious copying the code to each sheet.
Thanks

"Don Guillett" wrote:

More detail and code?
Maybe have a look in the ThisWorkbook module

--
Don Guillett
SalesAid Software

"Hamster07" wrote in message
...
Is there a way I can copy code across multiple worksheets without having
to
open each worksheet code page and individually paste the code in.




  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default Copy code

Hamster

Don't copy it to all sheets.

Place this in the Thisworkbook module..........will operate on all sheets.

Remove any code you have in the sheet module.

Private Sub Workbook_SheetBeforeDoubleClick _
(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Const WS_RANGE As String = "G2:G22"
If Not Intersect(Target, ActiveSheet.Range(WS_RANGE)) Is Nothing Then
For Each cell In Target
If Target.Interior.ColorIndex = 5 Then
Target.Interior.ColorIndex = xlNone
Else
Target.Interior.ColorIndex = 5
End If
Next
Cancel = True
End If
End Sub


Gord Dibben MS Excel MVP

On Tue, 30 Jan 2007 06:09:02 -0800, Hamster07
wrote:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As _
Boolean)
Const WS_RANGE As String = "G2:G22"
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
For Each cell In Target
If Target.Interior.ColorIndex = 5 Then
Target.Interior.ColorIndex = xlNone
Else
Target.Interior.ColorIndex = 5
End If
Next
Cancel = True
End If
End Sub

Don,
Thanks for the reply.
The above code is to re-colour the selected cells when double clicked. I
have 77 worksheets and its a bit laborious copying the code to each sheet.
Thanks

"Don Guillett" wrote:

More detail and code?
Maybe have a look in the ThisWorkbook module

--
Don Guillett
SalesAid Software

"Hamster07" wrote in message
...
Is there a way I can copy code across multiple worksheets without having
to
open each worksheet code page and individually paste the code in.







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
Macro Help (Uppercase multiple ranges?) Ken Excel Discussion (Misc queries) 14 December 2nd 06 07:23 PM
copy and use vba code Giz Excel Discussion (Misc queries) 9 November 22nd 06 09:57 PM
what is the vb code to copy rows from one sheet to another? bxc2739 Excel Discussion (Misc queries) 2 May 25th 06 07:48 PM
Copy Code Needed MWH Excel Worksheet Functions 1 June 22nd 05 06:49 AM
Make Change Case in Excel a format rather than formula Kevin Excel Worksheet Functions 1 March 18th 05 08:53 PM


All times are GMT +1. The time now is 08:37 PM.

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

About Us

"It's about Microsoft Excel"