Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default worksheet_change can reference excel range on other worksheet

My problem is worksheet code "worksheet_change" does not allow usage of a
named range thatis in another worksheet.
Example code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Start As Variant

If Target.Address = Range("A1").Address Then
Range("A4").Value = Range("myDate").Offset(Range("A1").Value - 1,
0).Resize(1, 1).Value
End If

End Sub

This code is behind worksheet1, the range "myDate" is in worksheet2

Any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default worksheet_change can reference excel range on other worksheet

See if it works when you tell it where to find the range:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Start As Variant
If Target.Address = Range("A1").Address Then
'Tell it where Range("myDate") is
Range("A4").Value = Worksheets(2).Range("myDate").Offset(Range _
("A1").Value - 1, 0).Resize(1, 1).Value
End If
End Sub


"Dreiding" wrote:

My problem is worksheet code "worksheet_change" does not allow usage of a
named range thatis in another worksheet.
Example code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Start As Variant

If Target.Address = Range("A1").Address Then
Range("A4").Value = Range("myDate").Offset(Range("A1").Value - 1,
0).Resize(1, 1).Value
End If

End Sub

This code is behind worksheet1, the range "myDate" is in worksheet2

Any suggestions?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default worksheet_change can reference excel range on other worksheet

Yes, this works and should take care of my immediate needs.
Thanks, - Pat


"JLGWhiz" wrote:

See if it works when you tell it where to find the range:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Start As Variant
If Target.Address = Range("A1").Address Then
'Tell it where Range("myDate") is
Range("A4").Value = Worksheets(2).Range("myDate").Offset(Range _
("A1").Value - 1, 0).Resize(1, 1).Value
End If
End Sub


"Dreiding" wrote:

My problem is worksheet code "worksheet_change" does not allow usage of a
named range thatis in another worksheet.
Example code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Start As Variant

If Target.Address = Range("A1").Address Then
Range("A4").Value = Range("myDate").Offset(Range("A1").Value - 1,
0).Resize(1, 1).Value
End If

End Sub

This code is behind worksheet1, the range "myDate" is in worksheet2

Any suggestions?

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
Private Sub Worksheet_Change(ByVal Target As Excel.Range) [email protected] Excel Worksheet Functions 0 December 21st 06 02:13 AM
Worksheet_Change(ByVal Target As Excel.Range) Daggi Excel Programming 3 June 29th 05 02:59 PM
Can you get the range reference for each page in a worksheet print range? Crosby Excel Programming 3 April 12th 05 06:06 PM
Many Sub Worksheet_Change(ByVal Target As Range) In One Worksheet MathewPBennett Excel Programming 4 December 24th 03 01:01 PM


All times are GMT +1. The time now is 12:02 AM.

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"