+ Reply to Thread
Results 1 to 9 of 9

Please help Looping In VBA

  1. #1
    Registered User
    Join Date
    11-04-2015
    Location
    London, england
    MS-Off Ver
    2007
    Posts
    60

    Please help Looping In VBA

    I Have the below VBA code but i cant get it to loop every time, until "rFound" is noting, also how do i change "Const FlName" so that it would save in the same file directoy as the xlsm file but everytimes it loops i want the txt file it creates to change its name in consecutive order e.g. chunk 1.txt, chunk 2.txt?
    all once "rFound" is noting i want it to say complete work


    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2405
    Posts
    25,009

    Re: Please help Looping In VBA

    I am giving this a try but can't test it without your file.

    You have a bug that I don't know how to fix because I am not sure what you are doing:

    Please Login or Register  to view this content.
    numRows and numColumns are not declared and never assigned a values. So they will be 0 here. I strongly recommend to everyone that they declare variables. Doing so prevents a lot of bugs and runtime errors.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-04-2015
    Location
    London, england
    MS-Off Ver
    2007
    Posts
    60

    Re: Please help Looping In VBA

    Hi, thank you for your help much appreciated, i have large amount of data but it always starts at cell E5, i want to cut the data and put it into a new sheet then exports as TXT file, finally i want to repeat this until no data is left in the original work sheet. now im getting a error at
    Please Login or Register  to view this content.
    run time error 76
    Last edited by shelim481; 08-30-2018 at 04:30 PM.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2405
    Posts
    25,009

    Re: Please help Looping In VBA

    What is the value of FCell when this error occurs?

  5. #5
    Registered User
    Join Date
    11-04-2015
    Location
    London, england
    MS-Off Ver
    2007
    Posts
    60

    Re: Please help Looping In VBA

    Now i get runtime error 91, for some reason it it starts separating each line into different sheets, it just does the first sheet correctly. but no txt files produced.

  6. #6
    Registered User
    Join Date
    11-04-2015
    Location
    London, england
    MS-Off Ver
    2007
    Posts
    60

    Re: Please help Looping In VBA

    Attachment 588544

    all i wanted was to separate out the data into txt files of 50 columns (with no speech marks)...the data is more complicated then one attached...
    I got it working with a little modification but i cant seem to get the txt files.....Any ideas?

    Please Login or Register  to view this content.


    I need the txt files in the same directory as the excel file, but it only works for one text file if i use
    Please Login or Register  to view this content.
    when i use
    Please Login or Register  to view this content.
    no txt files are created...
    Last edited by shelim481; 08-30-2018 at 05:46 PM.

  7. #7
    Registered User
    Join Date
    11-04-2015
    Location
    London, england
    MS-Off Ver
    2007
    Posts
    60

    Re: Please help Looping In VBA

    Working after some thinking ....thank you very much .... just need
    Please Login or Register  to view this content.
    to be saved at the xlms directory any ideas?
    when i change to ThisWorkbook.Path or something similar it does not do anything in the xlms file directory but adds files in the temp directory....
    Last edited by shelim481; 08-30-2018 at 06:19 PM.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2405
    Posts
    25,009

    Re: Please help Looping In VBA

    I can't help you any further without having your file. Remove any private data and attach it.

    The paper clip icon does not work for attachments. Instead, under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.

  9. #9
    Registered User
    Join Date
    11-04-2015
    Location
    London, england
    MS-Off Ver
    2007
    Posts
    60

    Re: Please help Looping In VBA

    Attachment
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. looping :(
    By cordoda in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-04-2018, 12:11 PM
  2. Looping
    By geniusufo007 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-18-2017, 12:22 PM
  3. # 2 looping if yes vba run#
    By daboho in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2016, 07:07 AM
  4. For Each Looping
    By aearce2000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2014, 12:48 PM
  5. Do Until Looping (not looping through all other columns)
    By orle8050 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2013, 10:37 AM
  6. Looping I think??
    By jimmyquinn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-12-2007, 08:24 AM
  7. Help:Looping
    By Buffyslay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2006, 02:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1