이 당신은 내가 아마하지 않았다 원래 게시물을 이해하면 어떻게 찾고 어떻게해야 : 아래 내 코드에 모습을 가질 수 있습니다. 시트 레이아웃에 대한 자세한 내용은 도움이 될 것입니다. 이 개념은 아마도 당신이 찾고있는 것을 가르치기에 충분할 것입니다. 제공된 스크린 샷을보고 레이아웃을 이해하십시오.
이 예에서는 이미 대상 시트를 만들었습니다. 이 예제의 "당신이 그 시트 NAMED 뭐든"변수 newSheet =를 선언 할 때 당신은 단지 헤더 행을 확인하고 시트의 이름을 지정해야하고, 그것은 "TargetSheet"의
Sub mymacro()
'Declare the counters as Integers, not byte
Dim oRow As Integer
Dim i As Integer
Dim LastRow As Integer
Dim LastNewRow As Integer
Dim newSheet As String
Dim nRow As String
Dim n As Integer
Dim LastNCol As Integer
Dim searchString As String
'Not Sure what kind of value the N points are.
Dim Value As String
'The original sheet is Sheets("laos"
'If you don't need to create the new Worksheet every time, just declare it.
newSheet = "TargetSheet"
'set LastRow using by specifying the sheet and range to search.
LastRow = Sheets("laos").Range("A65536").End(xlUp).Row
LastNewRow = Sheets(newSheet).Range("A65536").End(xlUp).Row
'Sets the destination Row on the newSheet
nRow = 2
'oRow = Original Row.
For oRow = 2 To LastRow
'This is looking to Row# N:, Column A for the value = "step" contained in the text
'If the InStr (InString) function returns a value greater than 0 meaning "step" occurs
searchString = Sheets("laos").Cells(oRow, 1)
If InStr(searchString, "step") > 0 Then
'Assuming you have to loop through N points, Find the last column of the STEP row.
LastNCol = Sheets("laos").Cells(oRow, Columns.Count).End(xlToLeft).Column
'Label the new Row
Sheets(newSheet).Cells(nRow, 1) = Sheets("laos").Cells(oRow, 1)
'start loop with 2 for ColumnB
For n = 2 To LastNCol
'Copy the VALUE from the original sheet, and set the new sheet with it.
Value = Sheets("laos").Cells(oRow, n)
Sheets(newSheet).Cells(nRow, n) = Value
Next n
'Since we are done copying all the N Points to the New Row, we increment the nRow + 1
nRow = nRow + 1
'Must END IF
End If
Next oRow
End Sub
이 줄로 무엇을하고자하셨습니까?'.Cells (n, 1) = "step"Then' –
"step"을 찾으십니까? 또는 "단계"? 공백이 중요하기 때문에 – peege
N 포인트가 기록 된 곳을 모르겠습니다. 그들은 "라오스"란에 있습니까? 라오스 페이지의 스크린 샷을 넣을 수 있습니까? 도움이 될거야. 나는 당신이 당신의 i Loop에 대한 가치 9763을 어디서 얻었는지 이해하지 못합니다. – peege