使用此代码,指定的单元格将复制到数据库工作表中,然后清除下一个条目的数据表单。如何修改代码以便不清除一个(或可能多个)单元格?
Executor executor;
try {
Class<?> dispatchClass = Class.forName("com.apple.concurrent.Dispatch");
Object dispatchInstance = dispatchClass.getMethod("getInstance").invoke(null);
executor = (Executor) dispatchClass.getMethod("getNonBlockingMainQueueExecutor").invoke(dispatchInstance);
} catch (Throwable throwable) {
throw new RuntimeException("Could not reflectively access Dispatch", throwable);
}
答案 0 :(得分:1)
添加另一个类似于myCopy
var。
dim myCopy as string, myClear as string
'cells to copy from Input sheet - some contain formulas
myCopy = "g12,g14,g18,g20,g22,g24,i16,i18,i20,i22,i24,k16,k18,k20,k22,k24,m16,m18,m20,m22,m24,o16,o18,o20,o22,o24,q16,q18,q20,q22,q24,s16,s18,s20,s22,s24,u16,u18,u20,u22,u24"
'cells to CLEAR from Input sheet
myClear = "g12,g18,g22,i16,i20,i24,k18,k22,m16,m20,m24,o18,o22,q16,q20,q24,s18,s22,u16,u20,u24"
现在使用该范围定义来清除单元格内容。
With .Range(myClear).Cells.SpecialCells(xlCellTypeConstants)
.ClearContents
Application.GoTo .Cells(1) ', Scroll:=True
End With