hi there,
i wrote a realy simple macro that multiply cells and lives a formula inside the cell.
same row , different column.
the life was too easy.
but the real problem is that i need the macro to be dinamic.
my meaning is:
the macro needs to identify the number of the column by the column name that inside the first row.
this is my macro:
the first column is sales and the second is price.
i need a dinamic macro that can find the column number/character.
to find the number its easy using match formula.
but, how can i express this to a character.
or that can be another way.
hope this is easy problem for you guys,
thanks,
asaf.
i wrote a realy simple macro that multiply cells and lives a formula inside the cell.
same row , different column.
the life was too easy.
but the real problem is that i need the macro to be dinamic.
my meaning is:
the macro needs to identify the number of the column by the column name that inside the first row.
this is my macro:
Code:
Sub lives_formula()
Dim lastrow As Integer
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For a = 2 To lastrow
first_co = ("a" & a)
second_co = ("b" & a)
Cells(a, "c").Formula = "=(" & first_co & "*" & second_co & ")"
Next a
End Sub
the first column is sales and the second is price.
i need a dinamic macro that can find the column number/character.
to find the number its easy using match formula.
but, how can i express this to a character.
or that can be another way.
hope this is easy problem for you guys,
thanks,
asaf.
Attachments
Last edited by a moderator: