How to find selected row?

J

Jack

I went through all properties searching for Selected or ActiveRow but I
cannot find it.
Jack
 
Z

Zack Barresse

Hello Jack,

How exactly would you like this information? If you're talking about while
looking at the worksheet, take a look directly left of the formula bar in
the Name box. There you'll see the active cell's address. If you're
talking VBA, then you can use Activecell.row, Activecell.column or
Activecell.Address. Remember the first two will give you numeric returns
while the last example will be a string (address).

Hope this is what you're referring to, you were not very clear.

HTH
 
J

Jack

Thank you both.

Set moExcelApp = CreateObject("Excel.Application")
Set moExcelWS = moExcelApp.ActiveWorkbook.ActiveSheet

moExcelWS.ActiveCell.Row does not work

moExcelApp.ActiveCell.Row does work

I am really confused about all that Excel stuff.
Why ActiveCell property belongs to the Excel application
but it does not belong to each sheet?
Logically, for the individual cell, spreadsheet is closer then the whole
app.
Jack
 
Z

Zack Barresse

The Row property belongs to a Range, not a Worksheet, Workbook or
Application. Reference them in this order..

Application
Workbook
Worksheet
Range
Row

If you would like more information, please tell us what application you are
working in, what language and the context (always helps).
 
J

Jack

I am using Excel automation and my application is written in visual basic.
I am not expert on Excel and find it quite inconsistent in many ways.
The current problem I have is this:
moExcelWS.Cells(CurrentRow, oXLLog).Text = Format(Date, "yyyy-mm-dd") & " "
& Format(Time, "hh:mm:ss") & """" & "," & """" & RecordedFile & """" & "," &
"""" & Record & """" & "," & """" & CallLength & """"

Using.Text in above code does NOT insert data in the specified cell,

however when I use .Value the data is written into cell.

moExcelWS.Cells(CurrentRow, oXLLog).Value = Format(Date, "yyyy-mm-dd") & " "
& Format(Time, "hh:mm:ss") & """" & "," & """" & RecordedFile & """" & "," &
"""" & Record & """" & "," & """" & CallLength & """"
Now, the data I am writing in is string data not numeric data. Why .Text
does not work?
Jack
 
Z

Zack Barresse

The Text property is read only, whereas the Value property is both read and
write.
 
Top