Dear Ashish
It works well and produced the 3 PDF files into the folder created. But there are 2 problems. 1. It will still says macro error and debug will bring me to the highlighted ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Soa\" & CL.Value & ".pdf", Quality:= _ xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _ OpenAfterPublish:=False Not exactly sure what went wrong. 2. For each time I replace with a new fruit, I would like to run a filter to refresh the list before sending into PDF, so I inserted this command that will hide all the blanks. ActiveSheet.Range("$A$9:$U$2001").AutoFilter Field:=1, Criteria1:="<>" But it did not work. Below the full sub. Appreciate your help. Sub pdf() Dim CL As Range Dim i As Long For Each CL In Range("Fruits") ActiveSheet.Range("d2").Value = CL.Value ActiveSheet.Range("$A$9:$U$2001").AutoFilter Field:=1, Criteria1:="<>" ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Soa\" & CL.Value & ".pdf", Quality:= _ xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _ OpenAfterPublish:=False Next End Sub From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of ashish koul Sent: Wednesday, 5 March 2014 12:49 AM To: excel-macros Subject: Re: $$Excel-Macros$$ VBA to change number try ths Sub test() Dim CL As Range Dim i As Long For Each CL In Range("fRUITS") ActiveSheet.Range("c5").Value = CL.Value ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Documents and Settings\Ashish Koul\My Documents\" & CL.Value & ".pdf", Quality:= _ xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _ OpenAfterPublish:=False Next End Sub On Tue, Mar 4, 2014 at 10:17 PM, elaine chong <christ...@gmail.com <mailto:christ...@gmail.com> > wrote: Thanks Ashish Can myarray be referring to a rangename call Fruits? Cos if to list out its a very long list. On 5 Mar 2014 00:45, "ashish koul" <koul.ash...@gmail.com <mailto:koul.ash...@gmail.com> > wrote: Sub test() Dim myarray As Variant Dim i As Long myarray = Array("Apple", "Orange", "Peer") For i = LBound(myarray) To UBound(myarray) ActiveSheet.Range("c5").Value = myarray(i) ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Documents and Settings\Ashish Koul\My Documents\" & myarray(i) & ".pdf", Quality:= _ xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _ OpenAfterPublish:=False Next End Sub On Tue, Mar 4, 2014 at 9:58 PM, elaine chong <christ...@gmail.com <mailto:christ...@gmail.com> > wrote: Can someone kindly help me with a macro please. I have in a list 5 items: Apple Orange Pear Figs Mango And I have in another sheet in cell C5, I want the macro to put Apple into it, send file to PDF, then put Orange into C5, send file to PDF,then put Pear into C5, send to PDF, and loop till last item Mango into C5 and send file to PDF. Would appreciate this. Thanks -- 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 <mailto:excel-macros+unsubscr...@googlegroups.com> . To post to this group, send email to excel-macros@googlegroups.com <mailto: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. -- Regards Ashish Koul Visit http://www.excelvbamacros.in <http://www.excelvbamacros.in/> Like Us on Facebook <http://www.facebook.com/pages/Excel-VBA-Codes-Macros/151803898222297> Join Us on Facebook <http://www.facebook.com/groups/163491717053198/> P Before printing, think about the environment. -- 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 a topic in the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/excel-macros/Y2Evc-0v2OU/unsubscribe. To unsubscribe from this group and all its topics, send an email to excel-macros+unsubscr...@googlegroups.com <mailto:excel-macros%2bunsubscr...@googlegroups.com> . To post to this group, send email to excel-macros@googlegroups.com <mailto: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 <mailto:excel-macros%2bunsubscr...@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. -- Regards Ashish Koul Visit http://www.excelvbamacros.in <http://www.excelvbamacros.in/> Like Us on Facebook <http://www.facebook.com/pages/Excel-VBA-Codes-Macros/151803898222297> Join Us on Facebook <http://www.facebook.com/groups/163491717053198/> P Before printing, think about the environment. -- 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 a topic in the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/excel-macros/Y2Evc-0v2OU/unsubscribe. To unsubscribe from this group and all its topics, send an email to excel-macros+unsubscr...@googlegroups.com <mailto:excel-macros+unsubscr...@googlegroups.com> . To post to this group, send email to excel-macros@googlegroups.com <mailto: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.