Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA - Returning Active Cell Column Property

Status
Not open for further replies.

DoDo1975

Technical User
Jun 4, 2002
18
CA
I would like to find the method to return the column of the active cell in VBA for access. If a cell is active or referred to through the Cells object using integers, how can I return the alphabetic equivalent for that cell?? I know that I could make a function or procedure to do this, but I should be able to have a built in excel function do it for me.

Even a link to the microsoft language reference for excel would help as I can't seem to find it on MS pages.

Thanks
 
Dim strActiveCell As String
Dim lngActiveColumn As Long
strActiveCell = oExcel.ActiveCell.Address
lngActiveColumn = CLng(Right(strActiveCell,Len(strActiveCell) - InStrRev(strActiveCell,"$"))

Depending on where and how you use it, you may either need to change or drop the oExcel object reference. BlackburnKL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top