Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / November 2007

Tip: Looking for answers? Try searching our database.

lookup formula or a macro?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tomi12619 - 11 Nov 2007 22:11 GMT
Hi

I have 2 sheets. There are one string like E1234 and one date on each sheets in one row...

E1234    11/11/2007
E5846    12/10/2007

The strings are the same in the two sheets in the same columns but they are in different rows related to the other sheet. My aim is: if one date has changed, the date would change on the other sheet also according to the string.
Bob Phillips - 11 Nov 2007 23:43 GMT
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "B:B"     '<== change to suit
Dim iRow As Long

   On Error GoTo ws_exit
   Application.EnableEvents = False

   If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
       With Target
           On Error Resume Next
           iRow = Application.Match(.Offset(0, -1).Value,
Worksheets("Sheet2").Columns(1), 0)
           On Error GoTo 0
           If iRow > 0 Then
               Worksheets("Sheet2").Cells(iRow, "B").Value = .Value
           End If
       End With
   End If

ws_exit:
   Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

Hi

I have 2 sheets. There are one string like E1234 and one date on each sheets
in one row...

E1234    11/11/2007
E5846    12/10/2007

The strings are the same in the two sheets in the same columns but they are
in different rows related to the other sheet. My aim is: if one date has
changed, the date would change on the other sheet also according to the
string.
Tamas Konczer - 13 Nov 2007 21:43 GMT
It isn't work properly, but thank you for your help. I can see the way
of the solution.

> Private Sub Worksheet_Change(ByVal Target As Range)
> Const WS_RANGE As String = "B:B"     '<== change to suit
[quoted text clipped - 44 lines]
> changed, the date would change on the other sheet also according to the
> string.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.