我是一个狂热的Excel用户,但在vba中并不强大。任何帮助表示赞赏。以下是我要做的步骤。
在B列中查找文本字符串。 - 使用偏移量来收集位于此字符串周围的两个值。偏移量(4,0)和偏移量(3,10) - 这样做总共四次,我们得到8个值。 - 将8个值粘贴到另一个工作簿中最后一行的8个连续单元格中
Set wkb = Excel.Workbooks.Open("c:\users\jojames\desktop\skillset performance with talktime.xls")
Set wks = wkb.Worksheets("Sheet1"): wks.Activate
find1Allscripts = "Allscripts - 10055"
Set Match1 = wks.Cells.Find(find1Allscripts)
findoffset1a = Match1.Offset(4, 0).Value
findoffset1b = Match1.Offset(3, 10).Value
find2Tier1 = "Tier1_ServiceDesk - 10052"
Set Match2 = wks.Cells.Find(find2Tier1)
findoffset2a = Match2.Offset(4, 0).Value
findoffset2b = Match2.Offset(3, 10).Value
find3Tier2 = "Tier2_ServiceDesk - 10053"
Set Match3 = wks.Cells.Find(find3Tier2)
findoffset3a = Match3.Offset(4, 0).Value
findoffset3b = Match3.Offset(3, 10).Value
find4Office = "Allscripts - 10055"
Set Match4 = wks.Cells.Find(find4Office)
findoffset4a = Match4.Offset(4, 0).Value
findoffset4b = Match4.Offset(3, 10).Value
'Paste the values'
Set wkb2 = ThisWorkbook
Set wks2 = wkb2.Sheets("ACD Data")
wks2.Activate
LastRow = wks2.Range("Y" & wks2.Rows.Count).End(xlUp).Row + 1
ActiveSheet.Range("Y" & LastRow).PasteSpecial xlPasteFormulas
Set wks = Nothing: Set wkb = Nothing
Set wks2 = Nothing: Set wkb2 = Nothing
答案 0 :(得分:1)
我认为这是一个不错的开始。我会在数组中存储我正在搜索的内容并循环遍历
private RecyclerView.LayoutManager mLayoutManager
顺便说一下,无需选择或激活任何东西。把它称为像我一样的对象。