Good Day all, just been doing some digging on this one, seen a few different things on google search but can't seem to make this work, i have now worked on (thanks to Minty) for the info on using IFNA()
whilst i have had a look at special cells in Excel, what i am trying to achieve here is to have the formulas remain in the excel cells but clear the cells.
So what i have done so far is:
Count how many contacts there are on Excel sheet contacts sheet
add to a temp table in Access
export back out to excel Orders sheet in the relevant cells
as we can see, all row numbers are incremented in the formulas which works great but after some searching, i would now like to clear the cells but keep the formulas in place
researching is pointing to use special cells but can't appear to clear cells
sure one of you guys can point the correct method ?
Add To Temp Table
Code:
'Add Data To Access' Find Last Row With Data
intLR = xlSHT2.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Set rs = CurrentDb.OpenRecordset("Select * From tblCodeUpdate")
strFind = "MATCH($B$"
strCode = rs.Fields("OrgCode")
strNum = mID(strCode, InStr(1, strCode, strFind) + 9, 1)
For i = 1 To intLR
iNextRow = DMax("RecordNo", "tblCodeUpdate") + 1
strTown = "=IFNA(INDEX(Customers!$B$1:B$2000,MATCH($B$" & iNextRow & ",Customers!$A$1:$A$20000)),"""")"
strPC = "=IFNA(INDEX(Customers!$C$1:C$2000,MATCH($B$" & iNextRow & ",Customers!$A$1:$A$20000)),"""")"
rs.AddNew
rs!RecordNo = iNextRow
rs!Town = strTown
rs!PostCode = strPC
rs.Update
Next i
gives me

Now add to Excel sheet
Code:
'Add From Access To Excel
intLR = xlSHT.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row ' Find Last Row With Data
Set rs = CurrentDb.OpenRecordset("Select * From tblCodeUpdate WHERE RecordNo >= 2")
With xlSHT
For x = 1 To intLR
Do Until rs.EOF
xlSHT.Cells(1 + intLR, 3).Formula = rs!Town
xlSHT.Cells(1 + intLR, 4).Formula = rs!PostCode
rs.MoveNext
intLR = intLR + 1
Loop
Next x
Gives me

What i have looked into in Excel

Any advice would be totally appreciated