Triggering a HTTP Search, through Cell Value Alteration

novalion

New Member
Joined
Aug 16, 2022
Messages
4
Office Version
  1. 2013
Platform
  1. Windows
Hi everyone, I have another question for everyone. This one is a bit complicated as several aspects of the code need fixing, and I am having a hard time doing so. If there are any helpful mind out there please have a look at he the problem below.

What the VBA code should do: Each time text is altered or added in any cells of the range A2:A (Sheet 1 Code), it triggers another module code (Module1) which then enteres the new text from the altered Cell in a the search bar in a website automatically (opens the browser if not open or simply opens the website if browser already open).

Problems:
1. Unable to link Sheet 1 Code to Module1, the Value of the Cell that has been identified as changed/newly added by Sheet 1 Code, is not entered into the website search bar. (Communication problem betweet the two Codes/Modules).
2. Sheet 1 Code gets triggered every time there is a change, even if the new cell is empty or altered just recently (within the last few seconds). Is there a way to get a code to ignore if a cell is empty and allow a delay before triggering Module 1 (so for example if Cell A2 contains "I Love Tomatoes", and is changed to "I Love Cucumbers" and back again to "I Love Tomatoes" within 20 seconds the code is NOT triggered.
3. The Range in Sheet 1 Code should be A2:A, but I have tried several things and the code does not work with it.

Sheet 1 Code:

VBA Code:
Public Sub Worksheet_Change(ByVal Target As Range)

Dim rangeToChange As Range

If Not Intersect(Target, Range("A2:A30000")) Is Nothing Then
Module1.ChromeGoogleSearch


End If

End Sub



Module1-ChromeGoogleSearch:
VBA Code:
Sub ChromeGoogleSearch()

    Dim obj As New WebDriver

 '***** Start Chrome *****

    obj.Start "chrome", ""

    obj.Get "https://www.google.com"

    Application.Wait DateAdd("s", 5, Now)

    
    SendKeys.Value = Sheet1.Target

    SendKeys "^{ENTER}", True
  

End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,214,793
Messages
6,121,619
Members
449,039
Latest member
Mbone Mathonsi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top