Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I send a list of cell values to a website in an excel macro?

I have a column of cells that I need to send to a website, one at a time, hitting the enter key between data entries. My data starts in cell "E4" and has a variable number of possible entries, up to 1000. I would like to send "E4" to the website and hit enter, then send "E5" and hit enter, repeating down the "E" column until I reach an empty cell.

I have managed to produce the desired result by utilizing SendKeys, but don’t know how to make SendKeys function with looping. Loop will end with a blank cell.

SendKeys ActiveSheet.Range("E4").Value
Application.Wait Now + TimeValue("00:00:001")
SendKeys "~"
Application.Wait Now + TimeValue("00:00:001")

SendKeys ActiveSheet.Range("E5").Value
Application.Wait Now + TimeValue("00:00:001")
SendKeys "~"
Application.Wait Now + TimeValue("00:00:001")

SendKeys ActiveSheet.Range("E6").Value
Application.Wait Now + TimeValue("00:00:001")
SendKeys "~"
Application.Wait Now + TimeValue("00:00:001")

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Something like this maybe:

Sub SendAll()
    Dim c As Range
    
    Set c = ActiveSheet.Range("E4") 'starting cell
    Do While Len(c.Value) > 0
        SendKeys c.Value
        Application.Wait Now + TimeValue("00:00:001")
        SendKeys "~"
        Application.Wait Now + TimeValue("00:00:001")
        
        Set c = c.Offset(1) 'next cell down
    Loop
    
End Sub
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading