Mohamedazees
New Member
- Joined
- Oct 18, 2020
- Messages
- 45
- Office Version
- 2019
- Platform
- Windows
Dear Sir,
I Need a excel Vba for apply formulas to the Columns "S" to "Z" if the cells in range - Column "R" is blank.
I already have a code but that update the formula for only One range of column and code is given below for your reference.
i have repeat these codes for each range - i.e., Column S to Z separately however i need to avoid the same and do this task at one click please help me.
Thanks in advance for your valuable supports.
Reference Code:
Sub Find_2BGSTIN()
Dim R As Range, rng As Range
With ActiveSheet
Set rngRates = .Range("Y4:Y" & Cells(Rows.Count, "K").End(xlUp).Row)
For Each C In rngRates
If C.Value = "" Then
C.Formula = "=IFERROR(VLOOKUP([@GRT],ITC_2B,5,FALSE),IFERROR(VLOOKUP([@GRD],ITC_2B[[GRD]:[ITC Availability]],4,FALSE),IFERROR(VLOOKUP([@GDT],ITC_2B[[GDT]:[ITC Availability]],3,FALSE),IFERROR(VLOOKUP([@RDT],ITC_2B[[RDT]:[ITC Availability]],2,FALSE),""""))))"
rngRates.Formula = rngRates.Value
End If
Next C
End With
ActiveSheet.AutoFilterMode = 0
End Sub
I Need a excel Vba for apply formulas to the Columns "S" to "Z" if the cells in range - Column "R" is blank.
I already have a code but that update the formula for only One range of column and code is given below for your reference.
i have repeat these codes for each range - i.e., Column S to Z separately however i need to avoid the same and do this task at one click please help me.
Thanks in advance for your valuable supports.
Reference Code:
Sub Find_2BGSTIN()
Dim R As Range, rng As Range
With ActiveSheet
Set rngRates = .Range("Y4:Y" & Cells(Rows.Count, "K").End(xlUp).Row)
For Each C In rngRates
If C.Value = "" Then
C.Formula = "=IFERROR(VLOOKUP([@GRT],ITC_2B,5,FALSE),IFERROR(VLOOKUP([@GRD],ITC_2B[[GRD]:[ITC Availability]],4,FALSE),IFERROR(VLOOKUP([@GDT],ITC_2B[[GDT]:[ITC Availability]],3,FALSE),IFERROR(VLOOKUP([@RDT],ITC_2B[[RDT]:[ITC Availability]],2,FALSE),""""))))"
rngRates.Formula = rngRates.Value
End If
Next C
End With
ActiveSheet.AutoFilterMode = 0
End Sub