选择两个单词之间的范围,然后根据不同的列将其删除

时间:2019-02-06 14:54:42

标签: excel vba

我发表了原始帖子(Selecting a Range depended on two Key Words)。我的代码是正确的,但是它没有执行我需要的操作。我需要帮助/指导来操作代码,以便在收入和总收入之间查看J列(如果为空),则会删除整行。我已尽力而为,但由于我目前正在学习VBA,因此我努力寻找甚至解决方法。

Excel File

到目前为止的代码:

Dim rngFirst As Range
Dim rngLast As Range

Dim rngUnion As Range
Application.ScreenUpdating = False

With Sheets("Input")
    'Find the start and stop
    Set rngFirst = .Cells.Find(what:="Performance Income", lookat:=xlWhole, _
        LookIn:=xlValues, MatchCase:=False)
    Set rngLast = .Cells.Find(what:="Miscellaneous Income", _
        lookat:=xlWhole, LookIn:=xlValues, MatchCase:=False)

    Set rngUnion = Range(rngFirst.Address, rngLast.Address)

    rngUnion.SpecialCells(xlCellTypeBlanks).EntireRow.Delete

End With

Application.ScreenUpdating = True

我感谢到目前为止的所有帮助以及所提供的任何帮助。谢谢。

1 个答案:

答案 0 :(得分:1)

我建议使用function getPaginationStore () { return Object.assign({}, pagination) } describe('Paginate.vue', () => { let localVue let wrapper let store beforeEach(() => { localVue = createLocalVue() localVue.use(Vuex) store = new Vuex.Store({ modules: { pagination: getPaginationStore() } }) wrapper = shallowMount(Pagination, { localVue, propsData: { items: [], size: 24 }, store }) }) afterEach(() => { store = null }) it('state should be 0', () => { expect(wrapper.vm.pageNumber).to.equal(0) wrapper.vm.$store.dispatch('pagination/nextPage') expect(wrapper.vm.pageNumber).to.equal(1) }) it('state should be 0 again but is 1', () => { // THIS TEST FAILS. IT IS ACTUALLY 1 expect(wrapper.vm.pageNumber).to.equal(0) }) }) 查找“收入”和“总收入”所在的行。然后在这些行之间检查J列Match中是否有空格,并删除.SpecialCells(xlCellTypeBlanks)

EntireRow