Add additional functionality to Macro
Posted on 2011-02-17
I have a macro (created on this site!) which transforms data held in the P Column, I would like to add another transformation to the data in Column T. In this column, we currently have start date of contract (dd/mm/yyyy format), I would like to transform this data to how long contract has been live. I already have a formula to work this out but need to add it to the macro.
Works out duration of contract.
Here is the existing macro
Dim sName As String, blankrow As Integer, rownum As Integer
Dim rng As Range, cell As Range
sName = ActiveSheet.Name
blankrow = 0
rownum = 1
If sName = "" Then Exit Sub
'Set rng = Range(Range("P1"), Cells(Rows.Count, 1).End(xlDown))
While blankrow < 10
Set cell = Range(("P" & rownum))
If cell.Text = "Full Time Employment" Then
cell.Value2 = "Employed FT"
ElseIf cell.Text = "Part Time Employment" Then
cell.Value2 = "Employed PT"
ElseIf cell.Text = "Temporary or Contract" Then
cell.Value2 = "Self Employed"
ElseIf cell.Text = "" Then
blankrow = blankrow + 1
rownum = rownum + 1