zzz-zzz
zzz-zzz

Reputation: 19

Excel VBA : To fill or replace blank value fast

Need your help to get same objective to fill up the "null" value faster than below script .

Sub FillEmptyCell()
  Dim rng As Range
  Dim i As Long
  Dim cell As Range
  Dim sht As Worksheet
  Set sht = ActiveWorkbook.Sheets("rawdata")
  sht.Activate
  Set rng = Range(Range("G2:G14614"), Range("G" & sht.UsedRange.Rows.Count))
  For Each cell In rng
    If cell.Value = "" Then cell.Value = "BLANKON"
  Next
End Sub

Upvotes: 1

Views: 181

Answers (1)

user4039065
user4039065

Reputation:

Try,

Sub FillEmptyCell()
    with workSheets("rawdata")
        with .range(.cells(2, "G"), .cells(.rows.count, "G").end(xlup))
            on error resume next
            .specialcells(xlcelltypeblanks) = "BLANKON"
            on error goto 0
        end with
        .Activate
    end with
End Sub

Upvotes: 4

Related Questions