On Apr 16, 1:48*pm, no...@newsgroup (Reventlov) wrote:
> Il giorno Fri, 16 Apr 2010 13:33:51 -0700 (PDT), Tom Lavedas <tglba...@newsgroup> ha
> scritto:
>
> >Something like this, I think (though I haven't analyzed what it is
> >supposed to accomplish, exactly - just addressed the syntax issue) ... >
> >Const xlDown =3D -4121
> > *xl.cells("AQ157").End(xlDown).Select
> > *xl.Range(xl.Selection, xl.Selection.End(xlDown)).Select >
> Obviously (?) at the top "XL" should be declared
> set xl=createobject("excel.application")
> This is useful as far as he is stuck on the "selection object required".
>
> --
> Giovanni Cenati (Bergamo, Italy)
> Write to "Reventlov" at katamail comhttp://digilander.libero.it/Cenati(Esempi e programmi in VbScript)
> -- I gave the code a try and I get this err:
E:\Scripts\VBS\Test_Find.vbs(37, 2) Microsoft VBScript runtime error:
Unknown runtime error
Here is my script so far:
Const ForReading = 1
Const xlCellTypeLastCell = 11
Const xlFormulas = -4123
Const xlPart = 2
Const xlByRows = 1
Const xlNext = 1
Const xlDown = -4121
strPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "") &
"test.xls"
boolMatchCase = False
Set xl = CreateObject("Excel.Application")
xl.Visible = True
xl.DisplayAlerts = FALSE
Set wb = xl.Workbooks.Open(strPath)
Set ws1 = wb.Worksheets(1)
Set ws2 = wb.Worksheets(2)
ws1.Activate
Set objRange = ws1.UsedRange
objRange.SpecialCells(xlCellTypeLastCell).Activate
intNewRow = XL.ActiveCell.Row + 1
strNewCell = "A" & intNewRow
Set mainRng = ws1.UsedRange.Cells
ColCount = mainRng.Columns.Count
RowCount = mainRng.Rows.Count
For R = 1 To mainRng.Rows.Count
For C = 1 To mainRng.Columns.Count
If ws1.Cells(R,C).Value = "IsInstalled" Then
ws1.Cells(R,C).Select
wscript.echo R & vbTab & C
xl.cells("AQ157").End(xlDown).Select '< -- this is line 37
xl.Range(xl.Selection, xl.Selection.End(xlDown)).Select
End If
'< ----- end script
Eventually I want to replace ("AQ157") with (R,C)