当工作表中的text ='Text'时,在相邻单元格上插入“XXX”,然后剪切&将整行粘贴到另一个工作表&环

时间:2017-08-24 11:27:57

标签: excel-vba vba excel

我正在尝试创建一个宏 - 当工作表中的text ='Text'时,在相邻的单元格上插入“XXX”,然后剪切&将整行粘贴到另一个工作表&循环直到所有相关的行都被切断 - 请有人帮忙......?

2 个答案:

答案 0 :(得分:0)

我不是100%理解您的问题,但我希望此代码适合您。 我试着让它变得简单,我在代码上做了笔记

    Private Sub CommandButton1_Click()
    'make command button .. it is better

    Dim ContainWord1 As String
    Dim finalrow As Integer
    Dim x As Integer


  finalrow = Range("A1000000").End(xlUp).Row
    'What phrase do you want to test for?
      ContainWord1 = "Text"



    'Loop through each cell in range and test cell contents

      For x = 2 To finalrow
 'you can change the columns to fit your worksheet
      If Sheet1.Cells(x, 1).Value = ContainWord1 Then Sheet1.Cells(x, 1).EntireRow.Cut Sheet2.Range("A100").End(xlUp).Offset(1, 0)

      Next x
    End Sub

答案 1 :(得分:0)

使用 class OnTabSelectedListener implements TabLayout.OnTabSelectedListener{ @Override public void onTabSelected(TabLayout.Tab selectedTab) { LinearLayout tabLayout1 = (LinearLayout)((ViewGroup) tabLayout.getChildAt(0)).getChildAt(selectedTab.getPosition()); TextView tabTextView = (TextView) tabLayout1.getChildAt(1); // tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.BOLD); tabTextView.setTextSize(20); } @Override public void onTabUnselected(TabLayout.Tab unselectedTab) { LinearLayout tabLayout1 = (LinearLayout)((ViewGroup) tabLayout.getChildAt(0)).getChildAt(unselectedTab.getPosition()); TextView tabTextView = (TextView) tabLayout1.getChildAt(1); //tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.NORMAL); tabTextView.setTextSize(15); } @Override public void onTabReselected(TabLayout.Tab tab) { } } Find。将评论的值更新为FindNext / Source

Destination