View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Find Date and Paste Data

Well, if I understand how your Ghost sheet is updated, you can put this macro
behind the sheet and when you update columns A - C for a given line, it will
automaitcally put the value in column F of Ghost into the
cell beneath the corresponding date in Calendar. To install the code, right
click the name tab on Sheets("Ghost"), then click "View Code" in the drop
down menu. Copy the code below and paste it into the code window. It tested
OK, but if you have problems, post back.


Sub Worksheet_Change(ByVal Target As Range)
lr = Sheets("Ghost").Cells(Rows.Count, 3).End(xlUp).Row
If Not Intersect(Range("C1:C" & lr), Target) _
Is Nothing Then
Set dtRng = Sheets("Ghost").Range("C" & Target.Row)
Set fRng = Sheets("Calendar").Cells _
.Find(dtRng.Value, LookIn:=xlValues)
If Not fRng Is Nothing Then
fRng.Offset(1, 0) = dtRng.Offset(0, 3).Value
End If
End If
End Sub





"AUCP03" wrote:

The "information" copied is in Col A - Col C. Col A is a list of item
numbers. Col B is a list of names. Col C is the dates. This information is
automatically populated from other sheets or at least will be copied from
them in the Col A-C format. I do a little reformatting of the information
input into Ghost to get Col F [=E3&" - "&A3].
Column E is initials determined via the formula
=INDEX(K$4:K$15,MATCH(B3,{"Chapman","Cobb","Darby" ,"Davis","Gooding","Hunt","Phillips","Quick","Ray" ,"Richey","Spear","Wade"},0))

So I am only using Col C and F from ghost but there are other things going
on. Once entered in the sheet they will not be changed unless there is a
user entry error in which case care would be taken to correct. And it will
be possible for multiple entrees to occur on the same day.
Ghost will be a hidden sheet eventually; I am using it as a go between.

Im not sure what the best method for starting the macro would be. I dont
want to duplicate the information on the Calendar, so I guess a button on the
Calendar or an execute upon exit cell command? I hope that didn't complicate
things too much.

Thanks for the response.
"JLGWhiz" wrote:

when information is added to Ghost the code

This is too ambiguous to work from. What infromation? What do you want to
specifically trigger the macro to copy data in column F of Ghost to the cell
below the corresponding date in Calendar? Are both the date in column C and
the data in column F of Ghost entered by the user, or is one of these
columns preset?

I was half way through the macro when it dawned on me that either or both
columns in Ghost might be changed and there is not way of knowing which
would occur first, therefor, if a worksheet change event was used to execute
the macro, it might copy a blank cell if the wrong column had data entered
first. If only one column will have an entry made, then we can make a
pretty simple macro to fix the problem.


"AUCP03" wrote in message
...
I have two worksheets. One is called Calendar and the other is called
Ghost.
Calendar is a sheet with dates in Columns B-H and J-P (1 week each). The
first dates are in row 4, but after that the rows with the dates appear in
different intervals. Ghost is a hidden sheet I populate with data from
another sheet. In Ghost Column C is dates and column F is data I want to
display on Calendar.

What I would like to happen is when information is added to Ghost the code
will go to the calendar find the associated date on the calendar that
matches
the Ghost data and date and put the data in the first empty cell
underneath
the date on Calendar. Advance warning I am not an expert on VB so please
be
gentle. Thank you.