Hello guys,
I have some header copied from a PDF specs, to Excel. I was trying to make it row-wise because of the deformation of the header. The macro that I set up worked half way, which means it gave me what I wanted but Excel kept searching along the column and had gone too far and then ended up an error: 1004.
Here is the data (after the process); var in Col A; code in Col B. Code 'x' serves as an indicator that shows the first word of the header.
If the data is not clear enough, please see the attached, which has both the data (the real data has over 200 rows, this is just a sample) and the macro.
Thanks in advance.
var code
Study
Identifier
Transmittal
Number
Unique
Subject
Identifier
Sub test()
Cells(1, 2).Activate
Do Until ActiveCell.Row >= 10
i = 1
While ActiveCell = ""
ActiveCell.Offset(-i, i + 1) = ActiveCell.Offset(, -1)
i = i + 1
ActiveCell.Offset(1).Activate
Wend
If ActiveCell.Row > 10 Then
Exit Sub
Else
ActiveCell.Offset(1).Activate
End If
MsgBox ActiveCell.Row
Loop
End Sub
I have some header copied from a PDF specs, to Excel. I was trying to make it row-wise because of the deformation of the header. The macro that I set up worked half way, which means it gave me what I wanted but Excel kept searching along the column and had gone too far and then ended up an error: 1004.
Here is the data (after the process); var in Col A; code in Col B. Code 'x' serves as an indicator that shows the first word of the header.
If the data is not clear enough, please see the attached, which has both the data (the real data has over 200 rows, this is just a sample) and the macro.
Thanks in advance.
var code
Study
x
Identifier Identifier
Transmittal
x
Number Number
Unique
x
Subject
IdentifierSubject
Identifier
Sub test()
Cells(1, 2).Activate
Do Until ActiveCell.Row >= 10
i = 1
While ActiveCell = ""
ActiveCell.Offset(-i, i + 1) = ActiveCell.Offset(, -1)
i = i + 1
ActiveCell.Offset(1).Activate
Wend
If ActiveCell.Row > 10 Then
Exit Sub
Else
ActiveCell.Offset(1).Activate
End If
MsgBox ActiveCell.Row
Loop
End Sub