Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default sheet code help

I have some Worksheet_Change code that I want to use but
cannot get it to work. I've probably got it all wrong but
a pointer in the right direction would be appreciated:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Count 1 Then Exit Sub
If Target.Column = 3 Or Target.Column = 6 Or Target.colum
= 9 Or Target.Column = 12 Or Target.colum = 15 Then
On Error GoTo errhandler
Application.EnableEvents = False
'do loads of stuff

End If
errhandler:
Application.EnableEvents = True
End Sub

TIA

Gareth
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default sheet code help

Just a few notes. I don't know if you copied this from the workbook or
rewrote it here, but you have "colum" and not "column" in several spots.

Also, do you want/need any 'else' statement for when your value is not less
than one of 3, 6, 9, 12, 15?

"gareth" wrote:

I have some Worksheet_Change code that I want to use but
cannot get it to work. I've probably got it all wrong but
a pointer in the right direction would be appreciated:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Count 1 Then Exit Sub
If Target.Column = 3 Or Target.Column = 6 Or Target.colum
= 9 Or Target.Column = 12 Or Target.colum = 15 Then
On Error GoTo errhandler
Application.EnableEvents = False
'do loads of stuff

End If
errhandler:
Application.EnableEvents = True
End Sub

TIA

Gareth

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default sheet code help

Mark

Thanks, hadn't noticed this spelling mistakes, it seems to
working fine now.

Gareth
-----Original Message-----
Just a few notes. I don't know if you copied this from

the workbook or
rewrote it here, but you have "colum" and not "column" in

several spots.

Also, do you want/need any 'else' statement for when your

value is not less
than one of 3, 6, 9, 12, 15?

"gareth" wrote:

I have some Worksheet_Change code that I want to use

but
cannot get it to work. I've probably got it all wrong

but
a pointer in the right direction would be appreciated:

Private Sub Worksheet_Change(ByVal Target As

Excel.Range)
If Target.Count 1 Then Exit Sub
If Target.Column = 3 Or Target.Column = 6 Or

Target.colum
= 9 Or Target.Column = 12 Or Target.colum = 15 Then
On Error GoTo errhandler
Application.EnableEvents = False
'do loads of stuff

End If
errhandler:
Application.EnableEvents = True
End Sub

TIA

Gareth

.

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
VB code to copy sheet format to another sheet ASU Excel Discussion (Misc queries) 12 August 10th 06 02:37 AM
Sheet Code Module: copying code to [email protected][_2_] Excel Programming 2 December 14th 04 01:57 AM
Sheet Code Glenn Robertson[_2_] Excel Programming 3 June 14th 04 06:27 PM
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet arunjoshi[_5_] Excel Programming 1 May 2nd 04 03:50 PM
unprotect sheet in code and make sheet visible peach255 Excel Programming 1 August 1st 03 03:28 AM


All times are GMT +1. The time now is 04:43 AM.

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"