Salve a tutti,
ho un foglio excel con dati e formule;vorrei copiare un riga del foglio con tutte le formule e convalide nella riga successiva senza dati;
Function InserisciRigaSullaSuccesivaConDatiFormattati(pEliminaSelezione As Boolean, pAttivaCellaColonna As Long) As Long
Dim lRange As Range, riga As Long, lWorkSheet As Excel.Worksheet
Dim tmp As String, tmp2 As String
Dim tmp11 As Single
riga = Application.ActiveCell.Row
Set lWorkSheet = Application.ActiveSheet
If 1 = 1 Then
With lWorkSheet
Set lRange = .Rows(Trim$(Str$(riga + 1)) & ":"& Trim$(Str$(riga + 1)))
lRange.Insert xlShiftDown
.Rows(Trim$(Str$(riga)) & ":"& Trim$(Str$(riga))).Copy
Set lRange = .Rows(Trim$(Str$(riga + 1)) & ":"& Trim$(Str$(riga + 1)))
'dovrebbe incollare solo formule formanti numeri,invece copi tutto
lRange.PasteSpecial Paste:=xlPasteFormulasAndNumberFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
If pEliminaSelezione = True Then
Application.CutCopyMode = False
End If
If pAttivaCellaColonna > 0 Then
.Cells(riga + 1, pAttivaCellaColonna).Select
End If
End With
End If
InserisciRigaSullaSuccesivaConDatiFormattati = riga
End Function
con l'opzione xlPasteFormulasAndNumberFormats dovrebbe copiare solo le formule,ma invece copia tutto
Stefano