Dummy Excel
Well-known Member
- Joined
- Sep 21, 2005
- Messages
- 1,004
- Office Version
- 2019
- 2010
- 2007
- Platform
- 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
Any help is greatly appreciated
regards
Sam
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