Hi experts,
I have an Excel sheet which resembles something like this:
Report Date:
StartDate:
xxxxx
-Empty Line-
Waiting Servers
--Empty Line--
ISSUED Server(s)------->This is the word I have to look for.
Name Email IssueDate RevokeDate ................
----there are many rows after this row------
I have to look for the word "ISSUED Server(s) in the excel sheet and then copy the next row ie Name Email IssueDate.... to another Excel Sheet. I wrote code so that it can look for the word ISSUED Server(s). BUt, I am struck at copying thing. can anyone tell me how to copy just one row after the word "ISSUED Server(S)ignoring all other rows. I cannot use the row number.
This is the code I have written so far to look for particular word "ISSUED Server(s)
Dim cnne As ADODB.Connection
Dim datarec As ADODB.Recordset
Set cnne = New ADODB.Connection
cnne.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\vb_project_ExcelToAccess\s_work.xls;Extended Properties=""Excel 8.0;HDR=YES;IMEX=1"""
cnne.Mode = adModeReadWrite
cnne.Open
Set datarec = New ADODB.Recordset
datarec.Open "SELECT * FROM [Sheet1$]", cnne, adOpenStatic
someval1 = "ISSUED Server(s)"
Dim nam1 As String
Dim flag As Boolean
Do While Not datarec.EOF
Do While True
For x = 1 To 19
If flag = True Then
Exit Do
End If
If nam1 = someval1 Then
flag = True
MsgBox "done"
Exit For
End If
Next
If flag = True Then
datarec.MoveNext
Exit Do
End If
If flag = False Then
datarec.MoveNext
If IsNull(datarec(0).Value) Then
Else
nam1 = datarec(0).Value
nam1 = Trim(nam1)
End If
End If
Loop
Loop
Thanks in advance
I have an Excel sheet which resembles something like this:
Report Date:
StartDate:
xxxxx
-Empty Line-
Waiting Servers
--Empty Line--
ISSUED Server(s)------->This is the word I have to look for.
Name Email IssueDate RevokeDate ................
----there are many rows after this row------
I have to look for the word "ISSUED Server(s) in the excel sheet and then copy the next row ie Name Email IssueDate.... to another Excel Sheet. I wrote code so that it can look for the word ISSUED Server(s). BUt, I am struck at copying thing. can anyone tell me how to copy just one row after the word "ISSUED Server(S)ignoring all other rows. I cannot use the row number.
This is the code I have written so far to look for particular word "ISSUED Server(s)
Dim cnne As ADODB.Connection
Dim datarec As ADODB.Recordset
Set cnne = New ADODB.Connection
cnne.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\vb_project_ExcelToAccess\s_work.xls;Extended Properties=""Excel 8.0;HDR=YES;IMEX=1"""
cnne.Mode = adModeReadWrite
cnne.Open
Set datarec = New ADODB.Recordset
datarec.Open "SELECT * FROM [Sheet1$]", cnne, adOpenStatic
someval1 = "ISSUED Server(s)"
Dim nam1 As String
Dim flag As Boolean
Do While Not datarec.EOF
Do While True
For x = 1 To 19
If flag = True Then
Exit Do
End If
If nam1 = someval1 Then
flag = True
MsgBox "done"
Exit For
End If
Next
If flag = True Then
datarec.MoveNext
Exit Do
End If
If flag = False Then
datarec.MoveNext
If IsNull(datarec(0).Value) Then
Else
nam1 = datarec(0).Value
nam1 = Trim(nam1)
End If
End If
Loop
Loop
Thanks in advance