Hi all, I really need your help.
But before that i'm gonna try to explain your what i'm trying to do .
My program is divided in 2 parts.
The first one will find all the 0 in the 2nd row, and it actually works perfectly.
In the second part , the program will find if the value of the second row is different than the value of the 12th row and if it's different it gonna add a new column, but the problem starts here , i need to put a formula ( for example : S13/$S$12*$S$2 , this example is for the columns that the image shows).
I'm trying to use R1C1 but the program shows me an error.
I'm gonna attach two pictures, and the program for a better understand.
And thank you so much
But before that i'm gonna try to explain your what i'm trying to do .
My program is divided in 2 parts.
The first one will find all the 0 in the 2nd row, and it actually works perfectly.
In the second part , the program will find if the value of the second row is different than the value of the 12th row and if it's different it gonna add a new column, but the problem starts here , i need to put a formula ( for example : S13/$S$12*$S$2 , this example is for the columns that the image shows).
I'm trying to use R1C1 but the program shows me an error.
I'm gonna attach two pictures, and the program for a better understand.
And thank you so much
VBA Code:
Sub Prueba1()
Dim a As Integer, b As Integer, i As Integer, j As Integer, c As Integer, f As Integer
x = Range("R2").CurrentRegion.Columns.Count
a = 2
b = 12
c = 13
i = 18
For i = i To x
If Cells(a, i) = 0 Then
Cells(a, i).EntireColumn.Delete
End If
Next
j = 18
For j = j To x
If Cells(a, j) <> Cells(b, j) Then
f = j + 1
Cells(c, f).EntireColumn.Insert
Cells(c, f).FormulaR1C1 = "=(RC[-1])/R " & b & "C19"" * R " & a & "C19""
End If
Next
End Sub
Last edited by a moderator: