Hello @Jyothi_SUVERA
Try this VBA code
Function ApplyCellBorderActiveCells(sheetName As String) As String
On Error GoTo ErrorHandler
For Each cell In Sheets(sheetName).UsedRange
If cell.Text = vbNullString Then GoTo SkipCell
With cell.Borders
.LineStyle = xlContinuous
.Color = xlBlack
End With
SkipCell:
Next cell
ApplyCellBorderActiveCells = "Success"
Exit Function
ErrorHandler:
Debug.Print Err.Description
ApplyCellBorderActiveCells = "Error: " & Err.Description
End Function