Need column name

[Closed]
Report
-
Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
-
Hello,

can anyone help me in the code given below.

i want column name in place of offset.what is the specific function to give column name.

For ZIP
If ActiveCell.Offset(0, 5).Value = "" Then
ActiveCell.Offset(0, 5).Value = 99999
End If
' For B
If ActiveCell.Offset(0, 6).Value = "" Then
ActiveCell.Offset(0, 6).Value = 0
End If
' For C
If ActiveCell.Offset(0, 7).Value = "" Then
ActiveCell.Offset(0, 7).Value = 0
End If
' For BI
If ActiveCell.Offset(0, 8).Value = "" Then
ActiveCell.Offset(0, 8).Value = 0
End If
' For TIV
If ActiveCell.Offset(0, 9).Value = "" Then
ActiveCell.Offset(0, 9).Value = 0
End If
' For CONST
If ActiveCell.Offset(0, 10).Value = "" Then
ActiveCell.Offset(0, 10).Value = 0
End If
' For YEAR
If ActiveCell.Offset(0, 11).Value = "" Then
ActiveCell.Offset(0, 11).Value = 9999
End If
' For FL
If ActiveCell.Offset(0, 12).Value = "" Then
ActiveCell.Offset(0, 12).Value = 0
End If
' For OCC
If ActiveCell.Offset(0, 13).Value = "" Then
ActiveCell.Offset(0, 13).Value = 0
End If
' For SQFT
If ActiveCell.Offset(0, 14).Value = "" Then
ActiveCell.Offset(0, 14).Value = 0
End If
' For COUNTRY
If ActiveCell.Offset(0, 18).Value = "" Then
ActiveCell.Offset(0, 18).Value = "USA"
End If
ActiveCell.Offset(1, 0).Select
Wend
End Sub

1 reply

Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
307
Hi Manish

If the column name is in row 1, you can access it using
cells(1,activecell.column).value

Let me know whether this helps...