Vlookup link to pivot - text/number question

  • Thread starter Thread starter Owl
  • Start date Start date
O

Owl

Hi,

Im linking my summary sheet to a pivot table using product codes. Because
the users have entered codes incorrectly, i keep getting n/a's where there is
obviously data in the pivot but isnt getting pulled through. This error
seems to disappear if i put an apostrophe at the start and if i retype the
whole code into the cell.

Is there a quick way of going through the errored ones and putting in the
apostrophe/retyping the code and ensuring this works?

Thanks!
 
Owl,

Select all the product code cells in your source data, and then run the macro below.

HTH,
Bernie
MS Excel MVP

Sub NumberToText()
Dim myCell As Range
Dim myCalc As Variant

With Application
.ScreenUpdating = False
myCalc = .Calculation
.Calculation = xlCalculationManual
.EnableEvents = False
End With

On Error Resume Next

For Each myCell In Selection.SpecialCells(xlCellTypeConstants, 1)
myCell.Value = "'" & myCell.Value
Next myCell

With Application
.ScreenUpdating = True
.Calculation = myCalc
.EnableEvents = True
End With
End Sub
 
Hi Bernie

Im not experienced at all using macros - is there another way to fix this
problem?
 
Try selecting all the cells with numbers and then formatting them for text.

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top