View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ricky Pang Ricky Pang is offline
external usenet poster
 
Posts: 53
Default Extract name, dates & number as criteria Then paste to current file

Hi Rob,
Thanks for your response. Here's my macro, albeit rough as it is, I
wasn't not able to do a (Number) lookup; thus, I had to manually goto
the proper cell ranges to paste my (Names).

Workbooks.Open Filename:= _
"C:\Extract Names.xls
Range("A1").Select
'A1 is just the Names. I should have also copied A2 beginning date, A3
ending date, A4 Number, but here's where I to specify what each of these
cells represent ie. perhaps dim A1 as ....
Selection.Copy
Windows("Current Worksheet.xls").Activate
'Instead of manually goto this range, here's where a lookup function to
search the copied A4 Number to match current worksheet's Row A header.
'Also need to match the beginning and ending dates listed on current
worksheet's column A
Range("F10:F14").Select
'before pasting the Names, check if there are data that's already there.
Popup warning and ask "Do you want to overwrite?". If yes, continue
with next line. If not, then end macro here.
'the Names are now pasted
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
'Need to goto 2nd cell and color as yellow
Range("F11").Select
Selection.Interior.ColorIndex = 6
'Then, goto every 3rd cell and color as green
Range("F14").Select
With Selection.Interior
.ColorIndex = 4
.Pattern = xlSolid
End With
'Goto the last cell and color as red
Selection.Interior.ColorIndex = 3
End


I've been searching throughout the newsgroups for something similar but
of no avail. Hopefully you could offer some guidance.

Thanks again,
Ricky

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!