简体   繁体   English

在一个 Excel 工作簿中搜索列以将相邻单元格的值粘贴到活动的 VBA 脚本中

[英]Search column in one Excel workbook to paste Adjacent Cell's Value into active VBA script

I have Workbook1 and Workbook2 and need to search column A in Workbook1 for specific string value and then copy adjacent cell that is in column B of Workbook1 to the macro being run where I need to insert the value in the following formula in VBA script: =(ROUNDUP((F2+40)/[VALUE],0))*[VALUE].我有 Workbook1 和 Workbook2,需要在 Workbook1 中的 A 列中搜索特定的字符串值,然后将 Workbook1 的 B 列中的相邻单元格复制到正在运行的宏中,我需要在 VBA 脚本中的以下公式中插入值:= (ROUNDUP((F2+40)/[VALUE],0))*[VALUE]。 The [VALUE] = the value taken from the adjacent cell in column B from Workbook1. [VALUE] = 取自 Workbook1 中 B 列中相邻单元格的值。 Workbook2 is where the macro is running on. Workbook2 是运行宏的地方。

I am being rushed at the moment and if this is not clear enough.我现在很匆忙,如果这还不够清楚。 I will come back and clarify as needed.我会根据需要回来澄清。

VALUE = WorksheetFunction.VLookup(theString, Workbooks("Workbook1").Worksheets("Sheet1").Range("A:B"), 2)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM