Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Referring to a cell without using Offset

Is there another way to refer to a cell that is in the same row and Column A
of the active cell. For example, let say Range("D8") is my activecell and I
want to refer to Range("A8"), how do I do that without using c.Offset(0,-3).

Thanks
Ayo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Referring to a cell without using Offset

Do you mean the first column of the row. If then

Cells(activecell.Row,1)

OR
Cells(activecell.Row,"A")

Or
Range("A" & Activecell.row)


If this post helps click Yes
---------------
Jacob Skaria


"Ayo" wrote:

Is there another way to refer to a cell that is in the same row and Column A
of the active cell. For example, let say Range("D8") is my activecell and I
want to refer to Range("A8"), how do I do that without using c.Offset(0,-3).

Thanks
Ayo

  #3   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Referring to a cell without using Offset

I am sorry but I forgot to add a very important part, I am using a For...
Each... Next statement. My goal is: for very cell in Range("D2:D5") say, I
want to assign the values in column A, B and C of the same row to different
cells in another worksheet, for eaxmple using the following snippet of code:

For Each rc In marketWS.Range(hdrColumn & "5:" & hdrColumn &
marketWSlastRow).Cells
If rc.Interior.ColorIndex = 3 Then
pastdueWS.Range("A" & pastdueWS_currRow) = rc.Offset(0,
marName)
pastdueWS.Range("B" & pastdueWS_currRow) = rc.Offset(0, NLP)
pastdueWS.Range("C" & pastdueWS_currRow) = rc.Offset(0, -1)
pastdueWS.Range("D" & pastdueWS_currRow) = rc.Offset(0,
candID)
pastdueWS.Range("E" & pastdueWS_currRow) = milestoneTitle
pastdueWS.Range("G" & pastdueWS_currRow) = "p"
pastdueWS_currRow = pastdueWS_currRow + 1
End If
Next rc

I want to replace the rc.Offset with something more general.


"Jacob Skaria" wrote:

Do you mean the first column of the row. If then

Cells(activecell.Row,1)

OR
Cells(activecell.Row,"A")

Or
Range("A" & Activecell.row)


If this post helps click Yes
---------------
Jacob Skaria


"Ayo" wrote:

Is there another way to refer to a cell that is in the same row and Column A
of the active cell. For example, let say Range("D8") is my activecell and I
want to refer to Range("A8"), how do I do that without using c.Offset(0,-3).

Thanks
Ayo

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Referring to a cell without using Offset

rc.parent.cell(rc.row, "A").value

gives you the value of Column A for the row that RC is on...
--
HTH...

Jim Thomlinson


"Ayo" wrote:

I am sorry but I forgot to add a very important part, I am using a For...
Each... Next statement. My goal is: for very cell in Range("D2:D5") say, I
want to assign the values in column A, B and C of the same row to different
cells in another worksheet, for eaxmple using the following snippet of code:

For Each rc In marketWS.Range(hdrColumn & "5:" & hdrColumn &
marketWSlastRow).Cells
If rc.Interior.ColorIndex = 3 Then
pastdueWS.Range("A" & pastdueWS_currRow) = rc.Offset(0,
marName)
pastdueWS.Range("B" & pastdueWS_currRow) = rc.Offset(0, NLP)
pastdueWS.Range("C" & pastdueWS_currRow) = rc.Offset(0, -1)
pastdueWS.Range("D" & pastdueWS_currRow) = rc.Offset(0,
candID)
pastdueWS.Range("E" & pastdueWS_currRow) = milestoneTitle
pastdueWS.Range("G" & pastdueWS_currRow) = "p"
pastdueWS_currRow = pastdueWS_currRow + 1
End If
Next rc

I want to replace the rc.Offset with something more general.


"Jacob Skaria" wrote:

Do you mean the first column of the row. If then

Cells(activecell.Row,1)

OR
Cells(activecell.Row,"A")

Or
Range("A" & Activecell.row)


If this post helps click Yes
---------------
Jacob Skaria


"Ayo" wrote:

Is there another way to refer to a cell that is in the same row and Column A
of the active cell. For example, let say Range("D8") is my activecell and I
want to refer to Range("A8"), how do I do that without using c.Offset(0,-3).

Thanks
Ayo

  #5   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Referring to a cell without using Offset

Thanks Jim. Works perfect.

"Jim Thomlinson" wrote:

rc.parent.cell(rc.row, "A").value

gives you the value of Column A for the row that RC is on...
--
HTH...

Jim Thomlinson


"Ayo" wrote:

I am sorry but I forgot to add a very important part, I am using a For...
Each... Next statement. My goal is: for very cell in Range("D2:D5") say, I
want to assign the values in column A, B and C of the same row to different
cells in another worksheet, for eaxmple using the following snippet of code:

For Each rc In marketWS.Range(hdrColumn & "5:" & hdrColumn &
marketWSlastRow).Cells
If rc.Interior.ColorIndex = 3 Then
pastdueWS.Range("A" & pastdueWS_currRow) = rc.Offset(0,
marName)
pastdueWS.Range("B" & pastdueWS_currRow) = rc.Offset(0, NLP)
pastdueWS.Range("C" & pastdueWS_currRow) = rc.Offset(0, -1)
pastdueWS.Range("D" & pastdueWS_currRow) = rc.Offset(0,
candID)
pastdueWS.Range("E" & pastdueWS_currRow) = milestoneTitle
pastdueWS.Range("G" & pastdueWS_currRow) = "p"
pastdueWS_currRow = pastdueWS_currRow + 1
End If
Next rc

I want to replace the rc.Offset with something more general.


"Jacob Skaria" wrote:

Do you mean the first column of the row. If then

Cells(activecell.Row,1)

OR
Cells(activecell.Row,"A")

Or
Range("A" & Activecell.row)


If this post helps click Yes
---------------
Jacob Skaria


"Ayo" wrote:

Is there another way to refer to a cell that is in the same row and Column A
of the active cell. For example, let say Range("D8") is my activecell and I
want to refer to Range("A8"), how do I do that without using c.Offset(0,-3).

Thanks
Ayo



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Referring to a cell without using Offset

rc.parent.cell(rc.row, "A").value

gives you the value of Column A for the row that RC is on...


Another way to return these same value...

rc.EntireRow.Cells(1).Value

--
Rick (MVP - Excel)
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
Referring a cell Terry0928 via OfficeKB.com Excel Discussion (Misc queries) 3 May 21st 10 09:22 AM
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Programming 4 September 28th 07 09:59 PM
Referring to a cell in another sheet Mike D. Excel Programming 2 April 5th 05 02:49 AM
cell text referring to tab name Trilexist Excel Worksheet Functions 1 February 15th 05 04:16 PM


All times are GMT +1. The time now is 09:51 PM.

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

About Us

"It's about Microsoft Excel"