Moderatori: Anthony47, Flash30005
ActiveCell.FormulaLocal = "=SE(I7=""Km"";K7*0,27;SE(I7=""Cena"";SE(L7<25;L7;SE(O7=""Pagato anche per altri"";L7;25));SE(I7=""Pranzo"";SE(L7<15;L7;SE(O7=""Pagato anche per altri"";L7;15));L7)))"
Sub CompilaSe()
UR = ActiveSheet.Range("I" & Rows.Count).End(xlUp).Row
For Riga = 2 To UR
If Range("I" & Riga).Value = "Km" Then Range("E" & Riga).Value = Range("K" & Riga).Value * 2.7
If Range("I" & Riga).Value = "Cena" Then
If Range("L" & Riga).Value < 25 Then
Range("E" & Riga).Value = Range("L" & Riga).Value
Else
Range("E" & Riga).Value = 25
End If
End If
If Range("I" & Riga).Value = "Pranzo" Then
If Range("L" & Riga).Value < 15 Then
Range("E" & Riga).Value = Range("L" & Riga).Value
Else
Range("E" & Riga).Value = 15
End If
End If
Next Riga
End Sub
ricky53 ha scritto:Ciao sascha,
prima di tutto ti invio un "benvenuta nel forum".
Prova con il registratore di macro:
1. seleziona la cella che contiene la formula (Es. "E3")
2. avvia il registratore di macro
3. premi "F2" + Invio
4. ferma il registratore di macro
5. vai a vedere cosa è stato scritto nel VBA Editor.
Comunque dovrebbe essere (ho scritto la formula nella cella "E3"):
ActiveCell.FormulaR1C1 = _
"=IF(RC[4]=""Km"",RC[6]*0.27,IF(RC[4]=""Cena"",IF(RC[7]<25,RC[7],25),IF(RC[4]=""Pranzo"",IF(RC[7]<15,RC[7],15),RC[7])))"
Ciao da Ricky53
Torna a Applicazioni Office Windows
Macro modifica date scelta periodo Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 11 |
Supporto per sviluppo macro VBA Ordinare per data Autore: Carletto Ribolla |
Forum: Applicazioni Office Windows Risposte: 3 |
Inserire add.in nella barra di avvio veloce in excel 2003 Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 4 |
Trasformare celle con formattazioni in html Autore: servicedynergy |
Forum: Applicazioni Office Windows Risposte: 5 |
Visitano il forum: Nessuno e 24 ospiti