ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find, select, cut and paste (https://www.excelbanter.com/excel-programming/412742-find-select-cut-paste.html)

Subenemi

Find, select, cut and paste
 
Hello

I am completely new to excel programming and I would like some help if
possible.
I have a spreadsheet with some logging information. I am trying to get
the text split when I found the string "Initializing server", which
can happens many times.
So basically, I need to create new sheets every time I found this
string, copying all the content found until it reaches the row with
that string to the new sheet.
Here is a piece of the log file:

| 2008-06-16 13:34:22.916 | 71212 | ArsInit | 101 | Initializing
server | 3
| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 201 | Entering Request
1 | 1
| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 227 | Received
Scriptname: /scripts/adess.dll | 1
| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 213 | Reading GET
request | 1
| 2008-06-16 13:35:01.462 | 71212 | ArsInit | 101 | Initializing
server | 3
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 231 | Creating request
| 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 219 | Created request
| 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 235 | Request: service
= GetPollingDelay | 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 235 | Request:
connectionKey = | 1

On this case, the result should be two sheets, one with this info

| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 201 | Entering Request
1 | 1
| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 227 | Received
Scriptname: /scripts/adess.dll | 1
| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 213 | Reading GET
request | 1

and another one with this

| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 231 | Creating request
| 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 219 | Created request
| 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 235 | Request: service
= GetPollingDelay | 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 235 | Request:
connectionKey = | 1

Is is possible to help me?

joel

Find, select, cut and paste
 
Not sure why my previous answer didn't get posted

Sub splitSheet()

InitStr = UCase("Initializing server")
With Sheets("Sheet1")
RowCount = 1
FirstRow = RowCount

Do While .Range("A" & RowCount) < ""
StrPos = InStr(UCase(.Range("A" & RowCount)), InitStr)
If .Range("A" & (RowCount + 1)) = "" Or StrPos 0 Then

If StrPos 0 Then
LastRow = RowCount - 1
Else
LastRow = RowCount
End If

If LastRow < 0 Then
Set newsht = Worksheets.Add(after:=Sheets(Sheets.Count))
.Rows(FirstRow & ":" & LastRow).Copy _
Destination:=newsht.Rows(1)
End If
FirstRow = RowCount + 1
End If
RowCount = RowCount + 1
Loop
End With
End Sub

"Subenemi" wrote:

Hello

I am completely new to excel programming and I would like some help if
possible.
I have a spreadsheet with some logging information. I am trying to get
the text split when I found the string "Initializing server", which
can happens many times.
So basically, I need to create new sheets every time I found this
string, copying all the content found until it reaches the row with
that string to the new sheet.
Here is a piece of the log file:

| 2008-06-16 13:34:22.916 | 71212 | ArsInit | 101 | Initializing
server | 3
| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 201 | Entering Request
1 | 1
| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 227 | Received
Scriptname: /scripts/adess.dll | 1
| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 213 | Reading GET
request | 1
| 2008-06-16 13:35:01.462 | 71212 | ArsInit | 101 | Initializing
server | 3
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 231 | Creating request
| 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 219 | Created request
| 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 235 | Request: service
= GetPollingDelay | 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 235 | Request:
connectionKey = | 1

On this case, the result should be two sheets, one with this info

| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 201 | Entering Request
1 | 1
| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 227 | Received
Scriptname: /scripts/adess.dll | 1
| 2008-06-16 13:34:22.948 | 71212 | ReqLoop | 213 | Reading GET
request | 1

and another one with this

| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 231 | Creating request
| 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 219 | Created request
| 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 235 | Request: service
= GetPollingDelay | 1
| 2008-06-16 13:35:01.477 | 71212 | ReqLoop | 235 | Request:
connectionKey = | 1

Is is possible to help me?



All times are GMT +1. The time now is 07:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com