+ Reply to Thread
Results 1 to 14 of 14

Keeps overwriting my output

  1. #1
    Registered User
    Join Date
    01-14-2021
    Location
    Saskatoon, Saskatchewan
    MS-Off Ver
    Excel 2019
    Posts
    20

    Keeps overwriting my output

    I am scraping price data from websites and although I can get the exact output I am looking for in the "Immediate" window, when I try to send it to a worksheet, it overwrites the cells with earlier data output with the last output. (I can't figure out how to add the attachement)

    Please help!!

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 05-14-2021 at 03:20 PM. Reason: added code tags

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

    Re: Keeps overwriting my output

    First I highly suggest indenting your code to show control structures. Otherwise it is very hard to read.

    Making the modifications shown in red will first find the last used row then write your data after that. Impossible to test without your file. If you have problems with this solution then attach the file. The paper clip icon does not work for attachments. To attach a file:

    1. Under the text box where you type your reply click the Go Advanced button.
    2. On the next screen scroll down and under the Attachments section click the Manage Attachments link, which will show a pop-up window.
    3. Click the Choose File button to select a file to attached.
    4. Click the Upload button to upload the file.
    5. Then click the Close This Window button. Your file is now attached to your post.

    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
    01-14-2021
    Location
    Saskatoon, Saskatchewan
    MS-Off Ver
    Excel 2019
    Posts
    20

    Re: Keeps overwriting my output

    Thanks for the suggestion. I tried it but, the problem persists.
    The values that I am seeking are returned, then, overwritten.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,810

    Re: Keeps overwriting my output

    Rule 03: Cross-posting Without Telling Us

    Your post does not comply with Rule 3 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Read this to understand why we ask you to do this.

    I have added the crosspost reference for you today. Please comply with this and all our rules in the future

    https://www.ozgrid.com/forum/index.p...ing-my-output/

    and
    http://www.vbaexpress.com/forum/show...ting-my-output

    and
    https://www.mrexcel.com/board/thread...utput.1170993/
    Last edited by alansidman; 05-14-2021 at 06:14 PM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    01-14-2021
    Location
    Saskatoon, Saskatchewan
    MS-Off Ver
    Excel 2019
    Posts
    20

    Re: Keeps overwriting my output

    I think that I uploaded the file.

    Again, sorry about the tags.

  6. #6
    Registered User
    Join Date
    01-14-2021
    Location
    Saskatoon, Saskatchewan
    MS-Off Ver
    Excel 2019
    Posts
    20

    Re: Keeps overwriting my output

    Okay, maybe I uploaded it on my second try.
    Attached Files Attached Files

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,530

    Re: Keeps overwriting my output

    The file you uploaded is your original code. It does not have the fix I suggested.

    Also I do not have the Selenium library you are referencing so I can't run your code.

  8. #8
    Registered User
    Join Date
    01-14-2021
    Location
    Saskatoon, Saskatchewan
    MS-Off Ver
    Excel 2019
    Posts
    20

    Re: Keeps overwriting my output

    Sorry about that, I uploaded an older iteration, so, here is the one with the changes that you suggested.
    Also, would there be a way to do this without using Selenium?
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    365 32bit Win
    Posts
    1,788

    Re: Keeps overwriting my output

    At the point where you populate the cells, the row is derived from the variable Count. This remains the same so each successive iteration will overwrite the previous value.

    Please Login or Register  to view this content.

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,530

    Re: Keeps overwriting my output

    Quote Originally Posted by ByteMarks View Post
    At the point where you populate the cells, the row is derived from the variable Count. This remains the same so each successive iteration will overwrite the previous value.
    Isn't this the same as the code in post #2?

  11. #11
    Registered User
    Join Date
    01-14-2021
    Location
    Saskatoon, Saskatchewan
    MS-Off Ver
    Excel 2019
    Posts
    20

    Re: Keeps overwriting my output

    Thanks for getting back to me.
    I tried running the code that you sent and the issue persists.
    The first date in the sequence is January 2, 2021.
    The routine finds that value and returns it to the worksheet, then, it finds the next date in the sequence, January 9, 2021, and it writes it into the cell that was occupied by the January 2 results.
    Then, it moves on to the row bellow and does the same thing over again (returning the January 2 results and then overwriting them with the January 9).

    Is it rerunning the entire routine for each loop? If so, how do I get it to move on to the next row before running the next loop?
    Attached Files Attached Files

  12. #12
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,530

    Re: Keeps overwriting my output

    Now I understand the point that ByteMarks was making. In the inner For loops you are assigning Count to RowNum each time through the loop. So you keep writing to the same row.

    Do this instead (just in this part of your code)
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    01-14-2021
    Location
    Saskatoon, Saskatchewan
    MS-Off Ver
    Excel 2019
    Posts
    20

    Re: Keeps overwriting my output

    I tried running it with the suggestions, but, ended up with the same result :-(

    Also, is there a way for me to get it to start in Row 1 rather than Row 2?
    Attached Files Attached Files

  14. #14
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,530

    Re: Keeps overwriting my output

    I ran it by stubbing out the Selenium calls and insert fake data and it ran fine. The only way I can help further is if you provide a way to load the Selenium library.

+ 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. Compare values and output cell titles, able to output multiple results
    By TMG2016 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 05-07-2016, 11:42 AM
  2. [SOLVED] Array to embed formula and if number of output is met output Blank
    By ywang in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-29-2015, 02:34 AM
  3. [SOLVED] Cell reference, output dates to numeric. Should output as text
    By lifeseeker1019 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-02-2015, 05:51 PM
  4. Overwriting an output cell to cause a different calculation ?
    By woohoo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-26-2013, 10:26 AM
  5. [SOLVED] Comparing two cells for similarities and output a third cell (if C1 = B1, then output A1)
    By PERFECT777 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-26-2013, 12:37 AM
  6. Looping through columns to copy output into other sheet, and saving output
    By eludlow in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-08-2009, 06:27 AM
  7. Importing several Output sheets into one consolidated Output Sheet
    By Ugh_Der in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-13-2009, 08:58 AM

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