Refreshing Data

Dummy Excel

Well-known Member
Joined
Sep 21, 2005
Messages
1,004
Office Version
  1. 2019
  2. 2010
  3. 2007
Platform
  1. Windows
Hi All,
I have some data that is dumped from our AS400 system which I download into Excel. I then use my macro to format the data and then run some vlookups.

When I run the macro I get #N/A in all my cells although if I do a F2 and enter, the vlookups return the correct data.

Is there a way that I can fix this within my macro?
my code is
Code:
    Dim End_Row As Long
    Application.Calculation = xlCalculationManual
    
    'Setting trim formula for rows
    End_Row = Cells(Rows.Count, "G").End(xlUp).Row
    Range("AI" & End_Row + 1).Formula = "=TRIM(RC[-28])"
    Range("AI" & End_Row + 1).Select
    Selection.Copy
    Range(Selection, Selection.End(xlUp)).PasteSpecial
    
    Application.Calculation = xlCalculationAutomatic
    
    'Pasting formula as values
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        
    'Pasting trim in data3
    Application.Calculation = xlCalculationManual
    Selection.Copy

    Range("G1").Select
    ActiveSheet.Paste
        
    'Delete working column
    [AG:AG].Delete

    Columns("E:E").Copy
    Columns("G:G").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Application.Calculation = xlCalculationAutomatic
    Range("A1").Select
    
End Sub

Any help is greatly appreciated
regards
Sam
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
It's a bit of a hack but I've often found that a find/replace works. *Find* every equals sign and *replace* it with another equals sign. This seems to provoke a recalc of each formula (same as your F2/Enter does).

ξ
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top