Range and Cells

S

stelios

Hi,

How can I convert the <<Cells( iRow,iCol)>> (eg. Cells(3,8)) in which range
it is ( eg. Range("H3"))?

Thanks!
 
F

Frank Kabel

Hi
why do you want to do this. Both statements return a range object. that
is
msgbox cells(3,8).address
returns the same as
msgbox range("H3").address
 
S

stelios

Hi Frank,

I use VBA Code in a Access Project by which I export the data to Excel. I
want to use the Range function with eg. Range("A1:A9") automated because eg.
the Range(Cells(1,1), Cells(1,9)) bring me an error!

Thanks!
 
F

Frank Kabel

Hi
what error do you get. Maybe you are missing the workbook and worksheet
reference
 
S

stelios

Hi again,

I have reference for Microsoft Excel 11.0 ..... some times works the VBA
Code with the Cell function and some times it doesn't..... The errors I get
are 1004(method 'Cells' of object '_Global' failed) and 462 , sometimes,
(remote server isn't available), I work locally.

The Code:
eg.
....
LastRow=....(From Recordset)
LastCol=....(From Recordset)
.....
Set objXL = New Excel.Application
Set objWkb = objXL.Workbooks.Open(WKB_PATH & XLT_NAME)
objWkb.SaveAs (WKB_PATH & WKB_NAME)
objXL.Visible = True
Set objSht = objWkb.Worksheets(SHT_NAME) ' error 9
objSht.Activate
objSht.Range(Cells(LastRow, 2), Cells(LastRow, LastCol)).Font.Bold =
True ' <- Here is the Problem
.....

end of eg.

Any Idea?

Thanks!
 
F

Frank Kabel

Hi
try
Range(objSht.Cells(LastRow, 2), objSht.Cells(LastRow,
LastCol)).Font.Bold = True
 
Top