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:
Module1-ChromeGoogleSearch:
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