PC Review


Reply
Thread Tools Rate Thread

Compare cells and force most recent change

 
 
Looping through
Guest
Posts: n/a
 
      13th Oct 2009
Is it possible to type some text into a cell on page 2 and force the changes
to a matching cell in sheet 1.

I.E
Sheet 2 line # 386, Note (Cell P386) = "10/1/09 - Should get order. 9/15/09
- Rep to follow up next week"
Sheet 1 line 1000, Note (Cell P1000 = "9/15/09 - Rep to follow up next week"

I want to be able to duplicate the notes in both worksheets without having
to go find the referenced line item and re-type the same info twice. My hope
is to keep everything consistant between sheets.

FYI... the line items will share a common # in Cell B.

Any help or direction will be great
 
Reply With Quote
 
 
 
 
B Lynn B
Guest
Posts: n/a
 
      13th Oct 2009
Assuming your notes are values of the column P cells, rather than comments on
those cells, this should work. Right click on the Sheet2 tab name, and
select "View Code" from the popup list. Paste the following lines into the
empty code screen that comes up. Whenever you make a change to column P on
sheet 2, it will change column P on sheet 1 to be the same as what you
entered, for the records with the same number in column B.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim myNote As String, myID As Long
Dim FirstRow As Long, RowCount As Long, myRow As Long

If Target.Column = 16 Then
myNote = Target.Value
myID = Cells(Target.Row, 2)
FirstRow = Sheets(1).UsedRange.Row
RowCount = Sheets(1).UsedRange.Rows.Count
For myRow = FirstRow To FirstRow + RowCount
If Sheets(1).Cells(myRow, 2) = myID Then
Sheets(1).Cells(myRow, 16).Value = myNote
End If
Next myRow
End If

End Sub


"Looping through" wrote:

> Is it possible to type some text into a cell on page 2 and force the changes
> to a matching cell in sheet 1.
>
> I.E
> Sheet 2 line # 386, Note (Cell P386) = "10/1/09 - Should get order. 9/15/09
> - Rep to follow up next week"
> Sheet 1 line 1000, Note (Cell P1000 = "9/15/09 - Rep to follow up next week"
>
> I want to be able to duplicate the notes in both worksheets without having
> to go find the referenced line item and re-type the same info twice. My hope
> is to keep everything consistant between sheets.
>
> FYI... the line items will share a common # in Cell B.
>
> Any help or direction will be great

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      13th Oct 2009
You dont need to loop..Either use Range.Find or
worksheetfunction.Match...Select the sheet tab 2 which you want to work with.
Right click the sheet tab and click on 'View Code'. This will launch VBE.
Paste the below code to the right blank portion. Get back to to workbook and
try out.

PS: The 1st sheet is referred as 'Sheet1;. Change to suit your requirement


Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet, rngTemp As Range
If Not Application.Intersect(Target, Range("P1:P100")) Is Nothing Then
If Target.Cells.Count = 1 And Trim(Range("B" & Target.Row)) <> "" Then
Set ws = Worksheets("Sheet1"): Application.EnableEvents = False
Set rngTemp = ws.Columns(2).Find(Range("B" & Target.Row))
If Not rngTemp Is Nothing Then ws.Range("P" & rngTemp.Row) = Target.Text
End If
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Looping through" wrote:

> Is it possible to type some text into a cell on page 2 and force the changes
> to a matching cell in sheet 1.
>
> I.E
> Sheet 2 line # 386, Note (Cell P386) = "10/1/09 - Should get order. 9/15/09
> - Rep to follow up next week"
> Sheet 1 line 1000, Note (Cell P1000 = "9/15/09 - Rep to follow up next week"
>
> I want to be able to duplicate the notes in both worksheets without having
> to go find the referenced line item and re-type the same info twice. My hope
> is to keep everything consistant between sheets.
>
> FYI... the line items will share a common # in Cell B.
>
> Any help or direction will be great

 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      13th Oct 2009
this will copy every entry on sheet2 to the same cell on sheet1. There's
nothing clever here. Right-click sheet2's tab, select View Code and paste
this code..its pretty apparent what it does

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("sheet1").Range(Target.Address).Value = Target.Value
End Sub



"Looping through" wrote:

> Is it possible to type some text into a cell on page 2 and force the changes
> to a matching cell in sheet 1.
>
> I.E
> Sheet 2 line # 386, Note (Cell P386) = "10/1/09 - Should get order. 9/15/09
> - Rep to follow up next week"
> Sheet 1 line 1000, Note (Cell P1000 = "9/15/09 - Rep to follow up next week"
>
> I want to be able to duplicate the notes in both worksheets without having
> to go find the referenced line item and re-type the same info twice. My hope
> is to keep everything consistant between sheets.
>
> FYI... the line items will share a common # in Cell B.
>
> Any help or direction will be great

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      13th Oct 2009
Hi Patrick, I know you are disturbed by yesterdays post..and I see someone
has re-posted that as a reply...Well; here OPs requirement is slightly
different from what you have suggested....and hence need a bit more
coding..Thanks


"Patrick Molloy" wrote:

> this will copy every entry on sheet2 to the same cell on sheet1. There's
> nothing clever here. Right-click sheet2's tab, select View Code and paste
> this code..its pretty apparent what it does
>
> Option Explicit
> Private Sub Worksheet_Change(ByVal Target As Range)
> Worksheets("sheet1").Range(Target.Address).Value = Target.Value
> End Sub
>
>
>
> "Looping through" wrote:
>
> > Is it possible to type some text into a cell on page 2 and force the changes
> > to a matching cell in sheet 1.
> >
> > I.E
> > Sheet 2 line # 386, Note (Cell P386) = "10/1/09 - Should get order. 9/15/09
> > - Rep to follow up next week"
> > Sheet 1 line 1000, Note (Cell P1000 = "9/15/09 - Rep to follow up next week"
> >
> > I want to be able to duplicate the notes in both worksheets without having
> > to go find the referenced line item and re-type the same info twice. My hope
> > is to keep everything consistant between sheets.
> >
> > FYI... the line items will share a common # in Cell B.
> >
> > Any help or direction will be great

 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      13th Oct 2009
cheers



"Jacob Skaria" wrote:

> Hi Patrick, I know you are disturbed by yesterdays post..and I see someone
> has re-posted that as a reply...Well; here OPs requirement is slightly
> different from what you have suggested....and hence need a bit more
> coding..Thanks
>
>
> "Patrick Molloy" wrote:
>
> > this will copy every entry on sheet2 to the same cell on sheet1. There's
> > nothing clever here. Right-click sheet2's tab, select View Code and paste
> > this code..its pretty apparent what it does
> >
> > Option Explicit
> > Private Sub Worksheet_Change(ByVal Target As Range)
> > Worksheets("sheet1").Range(Target.Address).Value = Target.Value
> > End Sub
> >
> >
> >
> > "Looping through" wrote:
> >
> > > Is it possible to type some text into a cell on page 2 and force the changes
> > > to a matching cell in sheet 1.
> > >
> > > I.E
> > > Sheet 2 line # 386, Note (Cell P386) = "10/1/09 - Should get order. 9/15/09
> > > - Rep to follow up next week"
> > > Sheet 1 line 1000, Note (Cell P1000 = "9/15/09 - Rep to follow up next week"
> > >
> > > I want to be able to duplicate the notes in both worksheets without having
> > > to go find the referenced line item and re-type the same info twice. My hope
> > > is to keep everything consistant between sheets.
> > >
> > > FYI... the line items will share a common # in Cell B.
> > >
> > > Any help or direction will be great

 
Reply With Quote
 
Looping through
Guest
Posts: n/a
 
      13th Oct 2009
Jacob, Your the best...

"Jacob Skaria" wrote:

> You dont need to loop..Either use Range.Find or
> worksheetfunction.Match...Select the sheet tab 2 which you want to work with.
> Right click the sheet tab and click on 'View Code'. This will launch VBE.
> Paste the below code to the right blank portion. Get back to to workbook and
> try out.
>
> PS: The 1st sheet is referred as 'Sheet1;. Change to suit your requirement
>
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Dim ws As Worksheet, rngTemp As Range
> If Not Application.Intersect(Target, Range("P1:P100")) Is Nothing Then
> If Target.Cells.Count = 1 And Trim(Range("B" & Target.Row)) <> "" Then
> Set ws = Worksheets("Sheet1"): Application.EnableEvents = False
> Set rngTemp = ws.Columns(2).Find(Range("B" & Target.Row))
> If Not rngTemp Is Nothing Then ws.Range("P" & rngTemp.Row) = Target.Text
> End If
> End If
> Application.EnableEvents = True
> End Sub
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Looping through" wrote:
>
> > Is it possible to type some text into a cell on page 2 and force the changes
> > to a matching cell in sheet 1.
> >
> > I.E
> > Sheet 2 line # 386, Note (Cell P386) = "10/1/09 - Should get order. 9/15/09
> > - Rep to follow up next week"
> > Sheet 1 line 1000, Note (Cell P1000 = "9/15/09 - Rep to follow up next week"
> >
> > I want to be able to duplicate the notes in both worksheets without having
> > to go find the referenced line item and re-type the same info twice. My hope
> > is to keep everything consistant between sheets.
> >
> > FYI... the line items will share a common # in Cell B.
> >
> > Any help or direction will be great

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare and return 2 most recent dates lookoutlisa Microsoft Access Queries 3 1st Jun 2006 02:43 AM
Compare multiple dates, can enumerate cell based on most recent date Brian Microsoft Excel Worksheet Functions 7 9th May 2006 11:02 PM
How to: Compare multiple dates and enumerate cell in row with most recent date Tred Microsoft Excel Discussion 1 8th May 2006 11:46 PM
How do I compare cells and if FALSE compare to next cell in EXCEL =?Utf-8?B?Q2luZGll?= Microsoft Excel Worksheet Functions 0 24th Mar 2006 05:29 PM
Compare dates in two tables to find most recent =?Utf-8?B?UG9ja2V0?= Microsoft Access 5 20th Jul 2005 09:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:33 PM.