Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 24
Default Problem with Multiple Ranges in code

I am using excel 2000

I have a spreadsheet into which sales data is enterred, for a range of cells e120:e138, named xEuro, the data is enterred as euros and automatically converts to £

The code is as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
Me.Protect UserInterfaceOnly:=True
If Not Intersect(Target, Range("e120:e138")) Is Nothing Then
If IsNumeric(Target) Then
Application.EnableEvents = False
Target = Round(Target / [xEuro], 0)
Target.NumberFormat = "###0,0.00"
Application.EnableEvents = True
End If
End If

End Sub

I now want to extend the range, to include 12 columns of data, but get an error message "Compile error wrong number of arguments or invalid property assignment" when I have more than 2 columns in the range

The code I have tried is as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
Me.Protect UserInterfaceOnly:=True
If Not Intersect(Target, Range("e120:e138", "k120:k138", "q120:q138)) Is Nothing Then
If IsNumeric(Target) Then
Application.EnableEvents = False
Target = Round(Target / [xEuro], 0)
Target.NumberFormat = "###0,0.00"
Application.EnableEvents = True
End If
End If

End Sub

What do I need to change to be able to add multiple ranges

Thanks in advance for any help

Paul
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Problem with Multiple Ranges in code

Try:

If Not Intersect(Target, Range("e120:e138,k120:k138,q120:q138")) Is Nothing Then



Paul S wrote:

I am using excel 2000

I have a spreadsheet into which sales data is enterred, for a range of
cells e120:e138, named xEuro, the data is enterred as euros and
automatically converts to £

The code is as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
Me.Protect UserInterfaceOnly:=True
If Not Intersect(Target, Range("e120:e138")) Is Nothing Then
If IsNumeric(Target) Then
Application.EnableEvents = False
Target = Round(Target / [xEuro], 0)
Target.NumberFormat = "###0,0.00"
Application.EnableEvents = True
End If
End If

End Sub

I now want to extend the range, to include 12 columns of data, but get
an error message "Compile error wrong number of arguments or invalid
property assignment" when I have more than 2 columns in the range

The code I have tried is as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
Me.Protect UserInterfaceOnly:=True
If Not Intersect(Target, Range("e120:e138", "k120:k138", "q120:q138))
Is Nothing Then
If IsNumeric(Target) Then
Application.EnableEvents = False
Target = Round(Target / [xEuro], 0)
Target.NumberFormat = "###0,0.00"
Application.EnableEvents = True
End If
End If

End Sub

What do I need to change to be able to add multiple ranges

Thanks in advance for any help

Paul

--
Paul S


--

Dave Peterson
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
Can I create Multiple passwords to edit multiple ranges? Conker10382 Excel Discussion (Misc queries) 8 December 31st 06 07:58 PM
How do i update multiple data ranges across multiple worksheets? mwah Excel Discussion (Misc queries) 0 July 6th 06 04:57 AM
Problem with dynamic ranges Jayne Excel Worksheet Functions 1 October 1st 05 06:01 AM
VLOOKUP for Zip Code Ranges JerseyJR Excel Worksheet Functions 2 September 6th 05 06:37 PM
Problem with graph ranges No Such Luck Charts and Charting in Excel 6 December 3rd 04 01:09 PM


All times are GMT +1. The time now is 04:18 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"