Niranjanrajrishi
Member
Hi,
My below code to assign formula and after the filter does not provide the desired result. When I use the code, it gives me strange output and result. Can you please help me?
After I filter, the desired range not found, then it should skip to next . I have a huge data and multiple formula needs to apply many places. If I can get a error free code, then I can use it.
Sample file attached.
Code: 1
Code: 2
Also is there any easy method to apply boarder and change the Font to Arial 10 (black color)?
My below code to assign formula and after the filter does not provide the desired result. When I use the code, it gives me strange output and result. Can you please help me?
After I filter, the desired range not found, then it should skip to next . I have a huge data and multiple formula needs to apply many places. If I can get a error free code, then I can use it.
Sample file attached.
Code: 1
Code:
Sub ModificationCriteriaOSVV()
Dim rng As Range
Sheets("OSV_Vendor").Activate
Application.DisplayAlerts = False
If ActiveSheet.AutoFilterMode Then ActiveSheet.Cells.AutoFilter
Rws = Cells(Rows.Count, "O").End(xlUp).Row
On Error Resume Next
ActiveSheet.Range("$A$1:$AO$" & Rws).AutoFilter Field:=15, Criteria1:="Modification", Operator:=xlFilterValues
Set rng = ActiveSheet.Range("$A1$2:$AQ$" & Rws).SpecialCells(xlCellTypeVisible)
If Not rng Is Nothing Then
Set rng = Range(Cells(2, "N"), Cells(Rws, "N")).SpecialCells(xlCellTypeVisible)
If Not rng Is Nothing Then rng = "=C2&"" - ""&A2&"" - ""&O2"
End If
With ActiveSheet
.AutoFilterMode = False
End With
End Sub
Code: 2
Code:
Sub ModificationCriteriaOSVV()
Dim rng As Range
Sheets("OSV_Vendor").Activate
Application.DisplayAlerts = False
If ActiveSheet.AutoFilterMode Then ActiveSheet.Cells.AutoFilter
Rws = Cells(Rows.Count, "O").End(xlUp).Row
On Error Resume Next
ActiveSheet.Range("$A$1:$AO$" & Rws).AutoFilter Field:=15, Criteria1:="New creation", Operator:=xlFilterValues
Set rng = ActiveSheet.Range("$A1$2:$AQ$" & Rws).SpecialCells(xlCellTypeVisible)
If Not rng Is Nothing Then
Set rng = Range(Cells(2, "N"), Cells(Rws, "N")).SpecialCells(xlCellTypeVisible)
If Not rng Is Nothing Then rng.Value = "=C2&"" - ""&A2&"" - ""&F2&"" - ""&O2"
End If
With ActiveSheet
.AutoFilterMode = False
End With
End Sub
Also is there any easy method to apply boarder and change the Font to Arial 10 (black color)?
Attachments
Last edited by a moderator: