简体   繁体   English

使用来自另一个工作表的连接引用更新单元格

[英]updating a cell with a concatenated reference from another sheet

I'm having trouble starting this VBA code. 我在启动此VBA代码时遇到问题。

I have two spreadsheets Sheet 1 and Sheet 2 that have data for clients. 我有两个电子表格Sheet 1和Sheet 2,它们包含客户端的数据。 The one column in sheet 2 has a value set to a number + Sales Office location(ie 750-UNKNOWN, 841-UNKNOWN, 160-NC - GREENVILLE). 工作表2中的一列的值设置为数字+销售办公室位置(即750-UNKNOWN,841-UNKNOWN,160-NC-GREENVILLE)。 I want to search that column for the "Unknown" value and use the number from that value ie 750 to match it from another worksheet (Sheet 1) by looking up the appropriate value and updating the cell in sheet 2 to that number and the name in the next cell by concatenating it in the cell. 我想在该列中搜索“未知”值,并使用该值中的数字,即750来匹配另一个工作表(工作表1),方法是查找相应的值并将工作表2中的单元格更新为该数字和名称通过在单元格中连接它在下一个单元格中。

Sheet 2 表2

  • Reference 参考

-771-UNKNOWN (cell H2) -771-UNKNOWN(单元格H2)

  • 720-UNKNOWN (Cell h3) 720-UNKNOWN(Cell h3)

    • Sheet 1 AB 表1 AB
      New FSO New FSO Name 新的FSO新FSO名称
      105 (A2) Kentucky (B2) 105(A2)肯塔基州(B2)
      60 (A3) Taft-Hartley (B3) 60(A3)塔夫脱 - 哈特利(B3)

I don't know where to begin with doing this. 我不知道从哪里开始这样做。

Additionally, I need to set a rule that if the value isn't found during the search ie if 750 isn't in the list, then return "No Sales Office located" 另外,我需要设置一个规则,如果在搜索过程中找不到值,即如果750不在列表中,则返回“No Sales Office located”

Thank you! 谢谢!

如果(中(h2,len(h2)-7),7)=“未知”,左(h2,len(h2)-7),“没有销售办公室”)如果未知是犹他州(那么它将改变7)将是4)。

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

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