Hello ,

I'm hoping you can help me with this macro that i started but i got stuck. the part that i'm having problems is with copying the formula "=left(W2,10) all the way down on Column "W" to the lastRow. i also want to incorporate the vlookup formula in the macro. I want this macro to work on any active worksheet that i select. one more thing, i want Column "G" data to be formated as Number.

Thank you in advance for all your help.

Walter

I'm hoping you can help me with this macro that i started but i got stuck. the part that i'm having problems is with copying the formula "=left(W2,10) all the way down on Column "W" to the lastRow. i also want to incorporate the vlookup formula in the macro. I want this macro to work on any active worksheet that i select. one more thing, i want Column "G" data to be formated as Number.

VBA Code:

```
Sub InsertColumnGP()
Dim ws As Worksheet
Set ws = ActiveSheet
'Insert Column to next to the Account number, to the right of Column W
ActiveSheet.Select
Range("AA1").Value = "BU"
Range("AB1").Value = "Amount"
Range("AC1").Value = "Portion"
Range("AD1").Value = "Balance"
Columns("X:X").Insert
Columns("X").NumberFormat = "General"
Columns("G").NumberFormat = "General"
Range("X1").Value = "Sub Account"
Range("X2").Formula = "= Left(W2, 10)"
With Sheets("ActiveSheet")
.Range("X2").AutoFill .Range("X2:X" & .Cells(.Rows.Count, "W").End(xlUp).Row)
End With
'= "=VLOOKUP(X2,'[Adaptive Level Hierarchy by Geoff 8.21.20_WA.xlsx]Levels (2)'!$C$10:$F$344,4,0)
End Sub
```

Thank you in advance for all your help.

Walter

Last edited by a moderator: