我有一个要搜索的数据表,并根据列表返回其值。我可以从G2中找到列表,并返回K2中的值,等等,但是我还需要它在列表上循环并获得列表中的下一个项目,在这种情况下为D030,并将结果附加在K4下,依此类推....请帮助?
这是代码:
Sub finddatalist()
Dim RCP As String
Dim finalrow As Integer
Dim i As Integer
Sheets("Data").Range("K2:N1000").ClearContents
RCP = Sheets("Data").Range("G2").Value
finalrow = Sheets("Data").Range("A10000").End(xlUp).Row
For i = 2 To finalrow
If Cells(i, 1) = RCP Then
Range(Cells(i, 1), Cells(i, 4)).Copy
Range("K100").End(xlUp).Offset(1, 0).PasteSpecial xlPasteFormulasAndNumberFormats
End If
Next i
End Sub
答案 0 :(得分:1)
[DllImport("extIO_IC7610.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
[return: MarshalAs(UnmanagedType.I1)]
public unsafe static extern bool InitHW(StringBuilder name, StringBuilder model, int* type);
unsafe void Initialize()
{
bool result;
int type = 0;
var name = new StringBuilder(250);
var model = new StringBuilder(250);
result = InitHW(name, model, &type);
string _name = name.ToString();
string _model = model.ToString();