Hi Ravinder, thanks again for your help however when i use the exact formula it doesnt work, i have been tring to find the issue but couldnt find.
this is the exact formula. Range("y2:y" & Range("a1").End(xlDown).Row).Formula = "=" & "IF(K2=" & "AIR" & ",VLOOKUP(X2,'C:\Users\User\Desktop\Reports\[Reason Codes.xlsx]Air'!$A$2:$B$62,2,FALSE),(IF(K2=" & "HOT" & ",vlookup(x2,'C:\Users\User\Desktop\Reports\[Reason Codes.xlsx]H otel'!$A$1:$B$62,2,FALSE),(IF(K2=" & "OTH" & ",vlookup(x2,'C:\Users\User\Desktop\Reports\[Reason Codes.xlsx]Others'!$A$1:$B$62,2,FALSE),IF(K2=" & "CAR" & ",vlookup(x2,'C:\Users\User\Desktop\Reports\[Reason Codes.xlsx]Car'!$A$1:$B$62,2,FALSE),VLOOKUP(x2,'C:\Users\User\Desktop\Reports\[Reason Codes.xlsx]Rail'!$A$1:$B$62,2,FALSE))))))" Thanks and Regards, Gargee Singh From: garge...@hotmail.com To: excel-macros@googlegroups.com CC: quote.ex...@gmail.com Subject: RE: $$Excel-Macros$$ Help with formula in vba Date: Sat, 7 Dec 2013 15:28:59 +0530 Hi Ravinder, thanks a lot, yes this is very helpful. exactly what i needed . :) Thanks and Regards, Gargee Singh From: ravinderexcelgr...@gmail.com To: excel-macros@googlegroups.com CC: quote.ex...@gmail.com Subject: RE: $$Excel-Macros$$ Help with formula in vba Date: Sat, 7 Dec 2013 12:45:01 +0530 Pfa, may be help you. From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of gargee singh Sent: Saturday, December 07, 2013 11:47 AM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Help with formula in vba Hello everyone, Hope you all are doing well. I need some help with inserting a formula with VBA , the formula checks for a condition in the cell K8 and and goes to another workbook to vlookup , my problem is that i only need to drop down the formula until cells in Row A is not blank and that will not be constant. so sometimes we may only have 10 rows of data that until A11 and sometimes more, how do i define this in the formula. the formula is in column y. =IF(K8="AIR",VLOOKUP(X8,'C:\Users\User\Desktop\Reports\[Reason Codes.xlsx]Air'!$A$2:$B$62,2,FALSE),(IF(K8="HOT",VLOOKUP(X8,'C:\Users\User\Desktop\Reports\[Reason Codes.xlsx]Hotel'!$A$1:$B$88,2,FALSE),IF(K8="CAR",VLOOKUP(X8,'C:\Users\User\Desktop\Reports\[Reason Codes.xlsx]Car'!$A$1:$D$59,2,FALSE),VLOOKUP(X8,'C:\Users\User\Desktop\Reports\[Reason Codes.xlsx]Others'!$A$1:$C$70,2,FALSE))))) Thanks. Gargee -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/groups/opt_out. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/groups/opt_out. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/groups/opt_out.