Ealcmhar
10-11-2012, 04:33 PM
Hi!
What I'm trying to accomplish is to grab the last cell with a value in column "a" and print it in cells within column "c" so long as the adjacent cell in column "b" isn't empty and the active cell is empty.
For instance:
----A------- -B -----------C
James ------Ruby ------Lowtown
Jim ---------Sapphire
Ferris -------Diamond
Middletown
"Middletown" being the last value in column "a" would be stored in the variable "nameH" and be printed in Column "C" three times, in the same rows as "Jim" and "Ferris", as their respective Column "C" cell are empty, while their respective Column "B" cell isn't empty.
I have what I could gather below:
Sub Test()
Dim nameH As String
nameH = Cells(Rows.Count, "a").End(xlUp)
For Each C In ActiveSheet.UsedRange.Cells
If B <> "" And C = "" Then C.Value = nameH
Next
End Sub
Any assistance would be appreciated.
Thanks!
What I'm trying to accomplish is to grab the last cell with a value in column "a" and print it in cells within column "c" so long as the adjacent cell in column "b" isn't empty and the active cell is empty.
For instance:
----A------- -B -----------C
James ------Ruby ------Lowtown
Jim ---------Sapphire
Ferris -------Diamond
Middletown
"Middletown" being the last value in column "a" would be stored in the variable "nameH" and be printed in Column "C" three times, in the same rows as "Jim" and "Ferris", as their respective Column "C" cell are empty, while their respective Column "B" cell isn't empty.
I have what I could gather below:
Sub Test()
Dim nameH As String
nameH = Cells(Rows.Count, "a").End(xlUp)
For Each C In ActiveSheet.UsedRange.Cells
If B <> "" And C = "" Then C.Value = nameH
Next
End Sub
Any assistance would be appreciated.
Thanks!