Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Referencing Cells in a Selected Row

I need to obtain the value in several cells from a row selected by the user.
What is the syntax that I should use to pull the values from the selected
row?

Dim sel As Range
Set sel = Application.Selection
sel.Cells(sel.row,1)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Referencing Cells in a Selected Row

Dim Cell As Range

For Each Cell In Selection
Debug.Print Cell
Next Cell


"dch3" wrote:

I need to obtain the value in several cells from a row selected by the user.
What is the syntax that I should use to pull the values from the selected
row?

Dim sel As Range
Set sel = Application.Selection
sel.Cells(sel.row,1)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Referencing Cells in a Selected Row

....or if you know what columns you are looking for:

MyValue = Cells(Selection.Row, 1)

etc.

"dch3" wrote:

I need to obtain the value in several cells from a row selected by the user.
What is the syntax that I should use to pull the values from the selected
row?

Dim sel As Range
Set sel = Application.Selection
sel.Cells(sel.row,1)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Referencing Cells in a Selected Row

Found the problem, I was thinking that the row number in the worksheet would
correspond to the row number in the selection which it does not. Since I
limited the number of rows that can be selected using sel.rows.count to
reference a cell the syntax would be sel.cells(1, [cell number])

"dch3" wrote:

I need to obtain the value in several cells from a row selected by the user.
What is the syntax that I should use to pull the values from the selected
row?

Dim sel As Range
Set sel = Application.Selection
sel.Cells(sel.row,1)

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
referencing selected cells [email protected] Excel Worksheet Functions 2 September 27th 06 07:22 PM
Referencing the First Cell in Any Selected Range maximouse Excel Programming 4 November 1st 05 03:57 AM
Referencing a Column in a Selected Range of Columns Rob G Excel Programming 3 October 21st 04 05:21 PM
referencing previously selected cells after macro execution begins Glenn Excel Programming 5 October 15th 04 12:52 AM
referencing values in adjacent cells to selected cell Darren Haslett Excel Programming 3 February 23rd 04 05:45 PM


All times are GMT +1. The time now is 07:21 AM.

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"