ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Have a Big Question (https://www.excelbanter.com/excel-discussion-misc-queries/131497-have-big-question.html)

Art[_2_]

Have a Big Question
 
Hello everyone! I have somewhat of a difficult question that I hope somebody
can answer. Here's the problem I'm trying to design a macro that can take
you to a web site and verify weather the site works and that there is also a
certain keyword there also. Now I used a GoToHtml code and it worked it
takes you to that website but that's it what I'm trying to do is to be able
to select mulitple rows and check them all instead of just one. So I'm
asking is this possible to do in VBA and make it a macro or is there a
different way to go about. Thanks to all who reads this and replies.



chad

Have a Big Question
 
I would try using a web query and bringing the information into excel. Then,
you can run a find feature to search for the information for which you are
looking. Hope this helps!

-Chad

"Art" wrote:

Hello everyone! I have somewhat of a difficult question that I hope somebody
can answer. Here's the problem I'm trying to design a macro that can take
you to a web site and verify weather the site works and that there is also a
certain keyword there also. Now I used a GoToHtml code and it worked it
takes you to that website but that's it what I'm trying to do is to be able
to select mulitple rows and check them all instead of just one. So I'm
asking is this possible to do in VBA and make it a macro or is there a
different way to go about. Thanks to all who reads this and replies.




Øyvind

Have a Big Question
 
Yes it si possible:
I think you have imported the WEB page to EXcel and read the sheet row by row.

Here is the code, copy and past it to your VBA.

There is to programes
The first searces the string the other is clearing the strings for blanks.
It si imortent to use cint() for integers and cstr() for strings.

Her is the programs
They are not debugged. TEST __ TEST __ TEST

'Copy your program VBA
'VarIbles
'WWWText=Text from WWW
'Content= 'The text that you serch after
'EXCEL_ROW = ' Row where the string was found
'---------- Functions in your row by row program
Res = FindString(WWWText, Content, EXCEL_ROW)
'if Res =cint(0) then .......... else .........


'---New program --- Function --- FindString and CleanBlank+from strings.

Public Function FindString(WWWText, Content, EXCEL_ROW)
'Clean the strings for "BLANK" positions.
Content = funCleanBlank(Content) ' Function block
WWWText = funCleanBlank(WWWText)
Dim LenContent As Integer
Dim StartPos As Integer
Dim Test As String
StartPos = CInt(0)
LenContent = CInt(Len(LenContent)) 'Number of letters to search.

Do
Test = CStr(Mid(WWWText, StartPos, LenContent))
If CStr(Test) = CStr(Content) Then GoTo StringIsHere
StartPos = StartPos + 1
Loop Until StartPos < CInt(lenContents)

EXCEL_ROW = 0 'If the Content is not fount return a zero.

StringIsHe 'Jumps to this point if found.
FindString = EXCEL_ROW 'Return the row where the Content was found
End Function


Public Function funCleanBlank(Text)
Dim Pos, ASCNum, SumTegn, BlankPos As Long
Dim Tegn, AkkText As String
BlankPos = CLng(InStr(Text, " "))' Important ****************
If CLng(BlankPos) = CLng(0) Then GoTo NoBlanks
If CStr(Text) = CStr(Empty) Or CStr(Tekst) = CStr("") Then GoTo NoBlanks
Pos = CLng(1)
SumTegn = CLng(Len(Text)) + CLng(1)
Do 'Clear blanks
Tegn = Mid(Text, Pos, 1)
ASCNum = Asc(Tegn)

If CLng(ASCNum) < CLng(32) Then AkkTekst = CStr(AkkTekst) + CStr(Tegn)
Pos = CLng(Pos) + CLng(1)
Loop While CLng(SumTegn) CLng(Pos)
GoTo Quit
NoBlanks:
AkkText = Text

Quit:
funReturTXTUtenBlankeTegn = AkkText

End Function

--
Øyvind


"Art" wrote:

Hello everyone! I have somewhat of a difficult question that I hope somebody
can answer. Here's the problem I'm trying to design a macro that can take
you to a web site and verify weather the site works and that there is also a
certain keyword there also. Now I used a GoToHtml code and it worked it
takes you to that website but that's it what I'm trying to do is to be able
to select mulitple rows and check them all instead of just one. So I'm
asking is this possible to do in VBA and make it a macro or is there a
different way to go about. Thanks to all who reads this and replies.





All times are GMT +1. The time now is 09:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com