Hi, i have two sheets and i have tables in that sheets...and my table like below format.and i wanna write sheet1's costs in sheet2 cost area...but that sheet2 's name sometimes not equal that sheet1's name and sometimes sheet1 not have sheet2's name , i was write that below code but that is give error code " run-time error '1004' "...how can i do that?
Sub write_equal() Sheets("sheet2").select range("a2").select do while not isempty(activecell) nameartist = activecell.value searcharea = Sheets("sheet1").range("a2:b100") if iserror(worksheetfunction.vlookup(nameartist,searcharea, 2,false))=true then activecell.offset(0,1).value = " We haven't this name in sheet1 or That name is not equal in sheet1's name" else activecell.offset(0,1).value = worksheetfunction.vlookup (nameartist,searcharea,2,false) end if activecell.offset(1,0).select loop end sub -------------------------------------------------------------------- that is sheets 1 _| A | B 1|---------------------|---------- 2| name | Cost 3|---------------------|---------- 4| Chames bond| 1.750 5| Mel Gibson | 1.500 6| Madonna | 2.000 -------------------------------------------------- that is sheet 2 _| A | B 1|---------------------|---------- 2| name | Cost 3|---------------------|---------- 4| Hames bond | 5| Mel Gibson | 6| MEdonna | 7| Rambo | --~--~---------~--~----~------------~-------~--~----~ Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To post to this group, send email to excel-macros@googlegroups.com For more options, visit this group at http://groups.google.com/group/excel-macros?hl=en Visit & Join Our Orkut Community at http://www.orkut.com/Community.aspx?cmm=22913620 To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com To see the Daily Excel Tips, Go to: http://exceldailytip.blogspot.com If you find any spam message in the group, please send an email to Ayush @ jainayus...@gmail.com -~----------~----~----~----~------~----~------~--~---