Hello! My Problem is that I don't know how to capture formula and than insert variable in it.
My code: red is what does not work
Sub urejanje()
ActiveCell.EntireRow.Cells(1, 15).Select
Do Until ActiveCell.Value = 3
If ActiveCell.Value = 1 Then
ActiveCell.Offset(0, -2).Activate
' the following line is red
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-12'!R[7]C10" ' this line is red
ActiveCell.Offset(0, -1).Activate
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-11'!R[7]C10"
ActiveCell.Offset(0, -1).Activate
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-10'!R[7]C10"
ActiveCell.Offset(0, -1).Activate
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-09'!R[7]C10"
ActiveCell.Offset(0, -1).Activate
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-08'!R[7]C10"
ActiveCell.Offset(0, -1).Activate
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-07'!R[7]C10"
ActiveCell.Offset(0, -1).Activate
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-06'!R[7]C10"
ActiveCell.Offset(0, -1).Activate
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-05'!R[7]C10"
ActiveCell.Offset(0, -1).Activate
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-04'!R[7]C10"
ActiveCell.Offset(0, -1).Activate
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-03'!R[7]C10"
ActiveCell.Offset(0, -1).Activate
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-02'!R[7]C10"
ActiveCell.Offset(0, -1).Activate
ActiveCell.Formula = _
"='C:\Documents and Settings\SMOLICM\Desktop\[Skupna_baza_podatkov.xls]energ. viri-01'!R[7]C10"
Selection.EntireRow.Interior.ColorIndex = 15
ActiveCell.Offset(1, 0).EntireRow.Cells(1, 15).Select
Else
ActiveCell.Offset(1, 0).EntireRow.Cells(1, 15).Select
End If
Loop
End Sub
I want to capture the red formula in active cell and than paste just the formulas adress R[x]Cx to formulas below. The formulas below I would write them myself, I just want the first formula R[x]Cx copied below.
I hope this is posible and that someone will know to help me.
Bookmarks