M
mission2java_78
Guest
Im using the find method of the Excel object model...I need to find the first cell in a row where there is no value...
I tried the following:
Pay close attention to the line:
I specified xlByRows...and it searches the columns..instead. Then me thinking ok maybe these are switched in excel so Ill try the constant xlByColumns. So I changed it to:
Only to get an error message saying with block or object not set? What the hell first time it doesnt search by rows..but by columns even though I ask it by row. Then I specify columns and I get an error?
Anyone shed some light on MS's object model here...
Jon
I tried the following:
Code:
Set objXL = CreateObject("Excel.Application")
Set objXLWrkBk = objXL.Workbooks.Open("C:\jhwork\Book1.xls")
Set objXLWrkSht = objXLWrkBk.Worksheets("Sheet1")
objXL.Visible = True
rs.MoveLast
rs.MoveFirst
objXLWrkSht.Range("A1").Activate
'MsgBox objXL.ActiveCell
'Set myRange = objXLWrkSht.Range("A1")
objXLWrkSht.Cells.Find("", , , , xlByRows, xlNext).Activate
'myRange.Activate
'MsgBox myRange.Row
'MsgBox myRange.Column
MsgBox objXL.ActiveCell
MsgBox objXL.ActiveCell.Row
MsgBox objXL.ActiveCell.Column
Pay close attention to the line:
Code:
objXLWrkSht.Cells.Find("", , , , xlByRows, xlNext).Activate
I specified xlByRows...and it searches the columns..instead. Then me thinking ok maybe these are switched in excel so Ill try the constant xlByColumns. So I changed it to:
Code:
objXLWrkSht.Cells.Find("", , , , xlByColumns, xlNext).Activate
Only to get an error message saying with block or object not set? What the hell first time it doesnt search by rows..but by columns even though I ask it by row. Then I specify columns and I get an error?
Anyone shed some light on MS's object model here...
Jon