View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] kemal@intelinfo.zzn.com is offline
external usenet poster
 
Posts: 27
Default Fill column with default value

Assuming your sheet name is "sheet1" and your data starts from row 2.
Right click your sheet tab and paste below code.
Will do the job when you select the sheet.Or tell me
how and when you want the code runs.

Private Sub Worksheet_Activate()
Dim rng As Range
Dim i As Range

Application.EnableEvents = False
Application.ScreenUpdating = False

With Worksheets("sheet1")
Set rng = .Range("a2", .Range("a" & Rows.Count).End(xlUp))
End With

For Each i In rng
i.Offset(, 2).Value = "P"
Next i

Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub