Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Excel 2007 Tables - Get Active Cell Row and Column

Does anyone know a quick way to get the relative position (row and
column) of the selected cell within a table? I've tried a few
different items, but to no avail:

tmpRow = Selection.ListObject.Listrow
tmpRow = Selection.ListObject.ListRows.Index
tmpRow = Selection.ListObject.Range.Row
and others ...

I know it's got to be simple, but any help would be appreciated.

Thanks in advance,

TB

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel 2007 Tables - Get Active Cell Row and Column


depending on where you want to count as the top left cell, something
along these lines:Sub blah()
Set xxx = ActiveSheet.ListObjects(1)
Set yyy = Intersect(Selection, xxx.DataBodyRange)
If Not yyy Is Nothing Then
rw = Selection.Row - xxx.DataBodyRange.Row + 1
cl = Selection.Column - xxx.DataBodyRange.Column + 1
MsgBox Cells(rw, cl).Address
End If
End Sub


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=128166

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Excel 2007 Tables - Get Active Cell Row and Column

I don't have access to v2007 just now, but something like

rowOffset = ActiveCell.Row - ActiveSheet.ListObjects(1).Row
colOffset = ActiveCell.Column - ActiveSheet.ListObjects(1).Column


"p45cal" wrote:


depending on where you want to count as the top left cell, something
along these lines:Sub blah()
Set xxx = ActiveSheet.ListObjects(1)
Set yyy = Intersect(Selection, xxx.DataBodyRange)
If Not yyy Is Nothing Then
rw = Selection.Row - xxx.DataBodyRange.Row + 1
cl = Selection.Column - xxx.DataBodyRange.Column + 1
MsgBox Cells(rw, cl).Address
End If
End Sub


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=128166


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
selection of cell at the intersection of column B and the row ofwhatever cell is active A & S Excel Programming 8 July 30th 09 05:05 PM
API to find position of active cell no longer working in 2007. GollyJer Excel Programming 5 June 13th 07 09:29 PM
Why doesn't active cell move using PageDown key in Excel 2007? Livonia Mike Excel Discussion (Misc queries) 1 May 8th 07 05:44 PM
Display of Active Cell in MS Excel 2007 Jasper Excel Discussion (Misc queries) 1 March 28th 07 08:36 PM
copying the column of the active cell to another column Paul James[_5_] Excel Programming 2 February 26th 04 08:04 PM


All times are GMT +1. The time now is 08:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"