
Sub DecurtaCittà()
Dim cella As Range
Set CellaPartenza = ActiveCell.Offset(0, 0)
MsgBox "NB: la decurtazione viene fatta su tutte le categorie"
Mess1 = "Scegli la provincia: "
Mess3 = "Scegli la % da decurtare: "
Provincia = InputBox(Mess1)
Percentuale = InputBox(Mess3)
For Each cella In Worksheets("Dati origine").Range(CellaPartenza, CellaPartenza.End(xlDown))
If cella.Value = Provincia Then CellaPartenza.Offset(0, 6).Resize(1, 13).Select
'fino a qui tutto ok
For Each c In Selection
c.Value = c.Value * Percentuale
'qui non funziona, non mi prende la percetuale, anche se al posto di inputbox inserisco una costate, tipo C.Value = C.value*0.5
Next
Next
End Sub |
Sub SelezionaCittà()
Dim Cella As Range, Città As String
Città = InputBox("Dammi la città")
With Worksheets("Dati origine").Range([A4], [A4].End(xlDown)).Select
For Each C In Selection
If C.Value = Città Then C.Count
Next
MsgBox Nr
End With
End Sub |
Sub SelezionaCittà()
Dim Città As String, Contatore As Integer, numrighe As Integer, Rng
Città = InputBox("Dammi la città")
Contatore = 0
Worksheets("Dati Origine").Activate
If ActiveSheet.FilterMode = True Then ActiveSheet.ShowAllData
numrighe = Cells(Rows.Count, 4).End(xlUp).Row
Set Rng = ActiveSheet.Range("D2", "D" & numrighe)
For Each C In Rng
If C.Value = Città Then
Contatore = Contatore + 1
End If
Next
MsgBox "N.ro" & " " & Contatore & " " & Città
End Sub
|
