HMODULE APIENTRY hLoadLibrary(LPCWSTR lpFileName) {
MessageBox(NULL, "NOT LOADING A LIBRA1RY!", "YO", MB_OK);
return NULL;
};
BOOL APIENTRY DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
{
DWORD* hookPointer = (DWORD*)&hLoadLibrary;
DWORD* originPointer = (DWORD*)GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryW");
DWORD offset = (DWORD)hookPointer - (DWORD)originPointer - 5;
DWORD oldProtect;
VirtualProtect((LPVOID)originPointer, sizeof(char) * 5, PAGE_EXECUTE_READWRITE, &oldProtect);
char* p = (char*)originPointer;
*p = '\xE9';
p++;
DWORD* q = (DWORD*)p;
*q = offset;
VirtualProtect((LPVOID)originPointer, sizeof(char) * 5, oldProtect, &oldProtect);
return TRUE;
}
上述代码(理论上)过滤“J1”,除了空白(“<>”)之外的任何内容,然后删除结果。问题是如果J列中只有空白数据,它会删除所有内容。
答案 0 :(得分:2)
我刚试过并测试过以下内容,它按预期执行:
Sub foo()
Set rng3 = Range("J1").CurrentRegion
rng3.AutoFilter Field:=10, Criteria1:="<>", Operator:=xlFilterValues
With rng3.SpecialCells(xlCellTypeVisible)
Application.DisplayAlerts = False
NewAddress = Replace(rng3.Rows.Name, "A$1", "A$2")
Range(NewAddress).Delete
Application.DisplayAlerts = True
End With
End Sub
或使用不同的方法:
Sub foo2()
LastRow = Sheet1.Cells(Sheet1.Rows.Count, "A").End(xlUp).Row 'Find the last row with data on Column A
For i = 2 To LastRow 'Loop from Row 2 to the Last Row with data
If Sheet1.Cells(i, 10).Value <> "" Then Sheet1.Rows(i).Delete 'Check Column J for any value, and if it has a value delete that row
Next i
End Sub