Posts by akjohno

    I am copying the formulas from a range of cells and pasting them in the cells below for a range that is calculated from a CountA value as per the below code. The trouble is that the paste stops in random places and doesn't complete to the correct number of rows. This has had me scratching my head for over a week now but I still can't see where my mistake is. Can someone possibly enlighten me? The copy range is 22 cells that I need to paste down for example 30000 rows below, so the same formula copies down from row. My macro might cut out at row 7251 in one instance, then I run the macro again and it cuts out at 7885 or just in random spots like that, even though my CountA number is 30000. Please help[Blocked Image:[email protected]/png/64/1f624.png] . Numshots is my CountA value....

    1. pastearea = "G5:AF" & NumShots + 3 'Assigns the variable pastearea the value of the cells we need to paste to
    2. Range("G4:AF4").Copy Destination:=ActiveSheet.Range(pastearea) 'Copies the formulas from cells G4 to AF4 to the entire range needed
    3. Do While Workbooks(wbname).Worksheets("Sheet1").Range("AF" & NumShots + 3) = ""

    Attachments if you wanted to see what I am doing. I can get this to run fine on my machine, but when a colleague runs it he nearly always has it fail somewhere in the final stages, i.e. when you open the final .csv file it creates data is missing from columns A and B after cells 2000/10000 or 20000 depending upon how his machine is feeling on the day. Makes it hard for me to fault find when he is remote to me.||

    I have written some code that brings in a .dat file data (4 columns of survey data). These columns can be up to 100 000 rows or more. When I run the macro it occassionally stops copying or putting the values in after a certain amount of cells (which varies) and I can't work out why. I have assumed that it is because the macro is moving on to the next line of code before the previous "pasting" of values has completed maybe? I am only pretty new to VBA and maybe I haven't used the correct variable type maybe?? I have added some loops in after these actions today and it seems ok so far but I would love some feedback if anyone can help me out PLEASE... This is my first post on this forum, hopefully I have done it correctly.