View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_528_] joel[_528_] is offline
external usenet poster
 
Posts: 1
Default Matching user entry to database value and pasting to correct cells


Try something like this. I think there were a few inconsistencies in
your posting so I'm not sure if I got it right.

with Sheets("Sheet1")
W1 = .Range("D1")
Amount = .range("B1")
end with


with Sheets("Sheet2")
'convert the date to a string to be used in the search in column A
DateStr = format(W1,"mm/dd/yyyy")
set c =
.columns("A").find(what:=DateStr,lookin:=xlvalues, lookat:=xlwhole)
if c is nothing then
msgbox("Cannot find Date : " & DateStr)
else
LastCol = .cells(c.row,columns.count).end(xltoleft).column
if LastCol < 5 then
NewCol= 5
else
NewCol = Lastcol + 1
end if
.cells(c.row,NewCol) = Amount
end if
end with


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=169957

Microsoft Office Help