Re: $$Excel-Macros$$ Macro to populate Output file
Hi its working fine at my place On Tue, Jul 3, 2012 at 1:38 AM, OJEMENI Uzoma uojem...@gmail.com wrote: Ashish, If i were to change the input from numbers too letters as in the *attached file*, what changes to the code would be necessary as i am having an error Run-time error '13' Type Mismatch. Thank you to a prompt response. On Mon, Jul 2, 2012 at 4:25 PM, OJEMENI Uzoma uojem...@gmail.com wrote: Thank you Ashish. The macro worked perfectly. On Mon, Jul 2, 2012 at 3:02 PM, ashish koul koul.ash...@gmail.comwrote: try this see if it helps Sub create_txtfile() Dim arv, st1 As String Dim s As Long, j As Long, k As Long MyFile = C:\Documents and Settings\user\Desktop\sample\ouputfile.txt 'set and open file for output With Sheets(Sheet1) .Range(x:x).Clear .Range(a1:a .Range(a1048576).End(xlUp).Row).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Range( _ k1), Unique:=True End With fnum = FreeFile() Open MyFile For Output As fnum Write #1, For i = 2 To Sheets(1).Range(k65356).End(xlUp).Row j = Application.WorksheetFunction.Match(Sheets(1).Range(k i).Value, Sheets(1).Range(a:a), 0) k = Application.WorksheetFunction.CountIf(Sheets(1).Range(a:a), Sheets(1).Range(k i).Value) + j - 1 st1 = arv = Sheets(1).Range(b j :b k) For s = LBound(arv) To UBound(arv) st1 = st1 arv(s, 1) Next st1 = Application.WorksheetFunction.Trim(st1) Print #1, Chr(34) Sheets(1).Range(k i).Value Chr(34) Chr(9) Chr(34) st1 Chr(34) Next i Close #fnum End Sub On Mon, Jul 2, 2012 at 12:00 PM, Ojemeni Uzoma uojem...@gmail.comwrote: ** Hello Everyone, Kindly assist with a Macro. Thanks. Uzoma Ojemeni Uzoma | Call 08060700717 -- *From: * OJEMENI Uzoma uojem...@gmail.com *Date: *Sun, 1 Jul 2012 19:02:25 +0100 *To: *excel-macros@googlegroups.com *Subject: *$$Excel-Macros$$ Macro to populate Output file Hello Everyone, I would appreciate some assistance in creating a macro to export the content in the file input to the file output. The spacing, tabs and apostrophe should remain the same way as it is in the output file. Thank you everyone. Ojemeni Uzoma -- FORUM RULES (986+ members already BANNED for violation) 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) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com -- *Regards* * * *Ashish Koul* *http://www.excelvbamacros.com/* *http://www.accessvbamacros.com/* http://www.accessvbamacros.com/ P Before printing, think about the environment. -- FORUM RULES (986+ members already BANNED for violation) 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) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 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) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss.
Re: $$Excel-Macros$$ Macro to populate Output file
Hello Everyone, Kindly assist with a Macro. Thanks. Uzoma Ojemeni Uzoma | Call 08060700717 -Original Message- From: OJEMENI Uzoma uojem...@gmail.com Date: Sun, 1 Jul 2012 19:02:25 To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Macro to populate Output file Hello Everyone, I would appreciate some assistance in creating a macro to export the content in the file input to the file output. The spacing, tabs and apostrophe should remain the same way as it is in the output file. Thank you everyone. Ojemeni Uzoma -- FORUM RULES (986+ members already BANNED for violation) 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) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com
RE: $$Excel-Macros$$ Macro to populate Output file
Can you please explain with sample data. Regards Rajan verma +91 7838100659 [IM-Gtalk] From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of Ojemeni Uzoma Sent: 02 July 2012 12:00 To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Macro to populate Output file Hello Everyone, Kindly assist with a Macro. Thanks. Uzoma Ojemeni Uzoma | Call 08060700717 _ From: OJEMENI Uzoma uojem...@gmail.com Date: Sun, 1 Jul 2012 19:02:25 +0100 To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Macro to populate Output file Hello Everyone, I would appreciate some assistance in creating a macro to export the content in the file input to the file output. The spacing, tabs and apostrophe should remain the same way as it is in the output file. Thank you everyone. Ojemeni Uzoma -- FORUM RULES (986+ members already BANNED for violation) 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) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 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) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com
Re: $$Excel-Macros$$ Macro to populate Output file
try this see if it helps Sub create_txtfile() Dim arv, st1 As String Dim s As Long, j As Long, k As Long MyFile = C:\Documents and Settings\user\Desktop\sample\ouputfile.txt 'set and open file for output With Sheets(Sheet1) .Range(x:x).Clear .Range(a1:a .Range(a1048576).End(xlUp).Row).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Range( _ k1), Unique:=True End With fnum = FreeFile() Open MyFile For Output As fnum Write #1, For i = 2 To Sheets(1).Range(k65356).End(xlUp).Row j = Application.WorksheetFunction.Match(Sheets(1).Range(k i).Value, Sheets(1).Range(a:a), 0) k = Application.WorksheetFunction.CountIf(Sheets(1).Range(a:a), Sheets(1).Range(k i).Value) + j - 1 st1 = arv = Sheets(1).Range(b j :b k) For s = LBound(arv) To UBound(arv) st1 = st1 arv(s, 1) Next st1 = Application.WorksheetFunction.Trim(st1) Print #1, Chr(34) Sheets(1).Range(k i).Value Chr(34) Chr(9) Chr(34) st1 Chr(34) Next i Close #fnum End Sub On Mon, Jul 2, 2012 at 12:00 PM, Ojemeni Uzoma uojem...@gmail.com wrote: ** Hello Everyone, Kindly assist with a Macro. Thanks. Uzoma Ojemeni Uzoma | Call 08060700717 -- *From: * OJEMENI Uzoma uojem...@gmail.com *Date: *Sun, 1 Jul 2012 19:02:25 +0100 *To: *excel-macros@googlegroups.com *Subject: *$$Excel-Macros$$ Macro to populate Output file Hello Everyone, I would appreciate some assistance in creating a macro to export the content in the file input to the file output. The spacing, tabs and apostrophe should remain the same way as it is in the output file. Thank you everyone. Ojemeni Uzoma -- FORUM RULES (986+ members already BANNED for violation) 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) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com -- *Regards* * * *Ashish Koul* *http://www.excelvbamacros.com/* *http://www.accessvbamacros.com/* http://www.accessvbamacros.com/ P Before printing, think about the environment. -- FORUM RULES (986+ members already BANNED for violation) 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) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com
Re: $$Excel-Macros$$ Macro to populate Output file
Thank you Ashish. The macro worked perfectly. On Mon, Jul 2, 2012 at 3:02 PM, ashish koul koul.ash...@gmail.com wrote: try this see if it helps Sub create_txtfile() Dim arv, st1 As String Dim s As Long, j As Long, k As Long MyFile = C:\Documents and Settings\user\Desktop\sample\ouputfile.txt 'set and open file for output With Sheets(Sheet1) .Range(x:x).Clear .Range(a1:a .Range(a1048576).End(xlUp).Row).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Range( _ k1), Unique:=True End With fnum = FreeFile() Open MyFile For Output As fnum Write #1, For i = 2 To Sheets(1).Range(k65356).End(xlUp).Row j = Application.WorksheetFunction.Match(Sheets(1).Range(k i).Value, Sheets(1).Range(a:a), 0) k = Application.WorksheetFunction.CountIf(Sheets(1).Range(a:a), Sheets(1).Range(k i).Value) + j - 1 st1 = arv = Sheets(1).Range(b j :b k) For s = LBound(arv) To UBound(arv) st1 = st1 arv(s, 1) Next st1 = Application.WorksheetFunction.Trim(st1) Print #1, Chr(34) Sheets(1).Range(k i).Value Chr(34) Chr(9) Chr(34) st1 Chr(34) Next i Close #fnum End Sub On Mon, Jul 2, 2012 at 12:00 PM, Ojemeni Uzoma uojem...@gmail.com wrote: ** Hello Everyone, Kindly assist with a Macro. Thanks. Uzoma Ojemeni Uzoma | Call 08060700717 -- *From: * OJEMENI Uzoma uojem...@gmail.com *Date: *Sun, 1 Jul 2012 19:02:25 +0100 *To: *excel-macros@googlegroups.com *Subject: *$$Excel-Macros$$ Macro to populate Output file Hello Everyone, I would appreciate some assistance in creating a macro to export the content in the file input to the file output. The spacing, tabs and apostrophe should remain the same way as it is in the output file. Thank you everyone. Ojemeni Uzoma -- FORUM RULES (986+ members already BANNED for violation) 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) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com -- *Regards* * * *Ashish Koul* *http://www.excelvbamacros.com/* *http://www.accessvbamacros.com/* http://www.accessvbamacros.com/ P Before printing, think about the environment. -- FORUM RULES (986+ members already BANNED for violation) 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) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 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) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com