[英]Excel - Vlook up with Imported data
In an Excel work book I have 2 tabs. 在Excel工作簿中,我有2个标签。 1 has imported data from another workbook.
1已从另一个工作簿导入数据。 The other I am attempting to do a vlookup, to fill in some cells based on the data in the first workbook.
我正在尝试进行另一个vlookup,以根据第一个工作簿中的数据填充一些单元格。 However, the vlook up is not working, until I look at the imported data, select the cell and hit enter.
但是,vlook up不起作用,直到我查看导入的数据,选择单元格并按Enter。 The data in the first worksheet will update and change according to the workbook it references.
第一个工作表中的数据将根据其引用的工作簿进行更新和更改。 Is there a way of making the v-look up work without manually hitting enter on the referred cells?
有没有一种方法可以使v查找工作而无需手动在引用的单元格上按Enter键?
My Vlook up function is: 我的Vlook up函数是:
VLOOKUP(B4,CAPA!A:AU,3,FALSE)
To confirm - calculation in formulas is set to automatic. 确认-公式中的计算设置为自动。
With the additional requirement to implement 5 seconds after opening the document? 附加要求在打开文件后执行5秒? I have added
Private Sub Workbook_Open(), Application.OnTime Now + TimeValue("00:00:10"), "test" End Sub
我添加了
Private Sub Workbook_Open(), Application.OnTime Now + TimeValue("00:00:10"), "test" End Sub
However on running the code, an error displays stating the macro does not exist or macros have been disabled (to confirm macros are enabled and trusted) 但是,在运行代码时,将显示错误消息,指出宏不存在或宏已被禁用(以确认宏已启用并受信任)
Many thanks 非常感谢
Right, you might need to convert the imported data from text to columns. 正确,您可能需要将导入的数据从文本转换为列。 Bit of a shot in the dark, but if that's the case, replace the rngTargetCols below as relevant and this should work -
有点黑暗,但是如果是这样的话,请替换下面的rngTargetCols,这应该可以-
Sub test()
Dim rngTargetCols As Range
Set rngTargetCols = Sheets("sheet1").Range("A:AU")
Dim intIndex As Integer
For intIndex = 1 To rngTargetCols.Columns.Count
On Error Resume Next
TextToColumnsFix rngTargetCols.Columns(intIndex)
On Error GoTo 0
Next
End Sub
Sub TextToColumnsFix(r As Range)
With r
.TextToColumns Destination:=.Worksheet.Cells(1, .Column), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
End With
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.