HI
I written the following if statement which should say if the variable ManualVN = yes then open a workbook (PPOWB) and copy data form that workbook into a new sheet in another workbook (PPCWB) and then close the workbook opened.
Then in (PPCWBSht) put a vlookup in H2 to look the value in cell C2, in the table area of ConvertManual!$A$2:$Y$4000. Then do an autofill and fill the rest of column H with that forumla.
If ManualVN = vbYes Then
Application.StatusBar = "Importing Manual data "
Set PPOWB = Application.Workbooks.Open(strFldr & "/" & "HDE_PPIII_Month_Calculations_Table_V" & ManualImportVN & ".xlsx")
Set PPOWBSht = PPOWB.Sheets("CalcAPD")
PPCWB.Sheets.Add.Name = "ConvertManual"
PPOWBSht.Range("C1:J20000").Copy Destination:=PPCWB.Sheets("ConvertManual").Range("A1")
PPOWB.Close
k = WorksheetFunction.CountA(PPCWBSht.Range("A:A"))
PPCWBSht.Range("H2").Formula = "=IF(C2=0,0,VLOOKUP($C2,ConvertManual!$A$2:$Y$4000," & 6 & ",FALSE))"
PPCWBSht.Range("H2").AutoFill Destination:=PPCWBSht.Range("H2:H" & k)
Application.StatusBar = "Formatting and deleteing temporary Sheet"
PPCWBSht.Cells.Copy
PPCWBSht.Range("A1").PasteSpecial Paste:=xlPasteValues
End If
Now the macro works and the vlookups put in work for half of column H and then half way down the rest show #N/A, i deleted the #n/a and manually entered the formula and it worked fine. Can anyone explain why its working in half of the column H but not the otehr half?
Thanks
Jeskit
Bookmarks