Hi All,
I have got myself in to a bit of a Monday morning mess!
I have used a piece of code to do the following:
1.Read through a section of data (B17:M47)
2.IF "B" is NOT blank and "M" IS, copy it
3.Find first blank row in range (B17:M47) of new worksheet
4.Paste it.
It works well and is stable. I am trying to adjust the code to now do this
1.Read the same section of data
2.IF "B" is NOT blank and "F" contains an "X" copy JUST "B"
3.Find the first clear row in range B4:B13,E4:E13 or G4:G13
3.Paste it.
The problems I am getting are:
It only copies the first entry regardless of data
It copies the whole row instead of just the first cell
It copies whether there is an "X" or not
Can anyone shed any light on this for me?
Thanks in advance, Witham
I have got myself in to a bit of a Monday morning mess!
I have used a piece of code to do the following:
1.Read through a section of data (B17:M47)
2.IF "B" is NOT blank and "M" IS, copy it
3.Find first blank row in range (B17:M47) of new worksheet
4.Paste it.
It works well and is stable. I am trying to adjust the code to now do this
1.Read the same section of data
2.IF "B" is NOT blank and "F" contains an "X" copy JUST "B"
3.Find the first clear row in range B4:B13,E4:E13 or G4:G13
3.Paste it.
The problems I am getting are:
It only copies the first entry regardless of data
It copies the whole row instead of just the first cell
It copies whether there is an "X" or not
Can anyone shed any light on this for me?
Thanks in advance, Witham
Code:
Dim i As Long
Dim MS As Worksheet
Set MS = Sheets(NxtSht) 'variable defined elsewhere in code
NR = 17
With Sheets(ThsSht) 'variable defined elsewhere in code
For i = 17 To 47
If .Cells(i, "B") <> vbNullString And .Cells(i, "M") = vbNullString Then
.Cells(i, "B").Resize(, 11).Copy MS.Range("B" & NR)
NR = NR + 1
End If
Next i
End With