Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Referring a cell | Excel Discussion (Misc queries) | |||
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul | Excel Worksheet Functions | |||
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul | Excel Programming | |||
Referring to a cell in another sheet | Excel Programming | |||
cell text referring to tab name | Excel Worksheet Functions |