Hello, trying to figure out a way to edit the below code to where if the cell is an X then when pasting into the other sheet2 then it goes as "Yes" and if it is blank on sheet1 then it is "No" on sheet2. However the way i have the code it is using xlToLeft and because of that when pasting on 163 and going down every 6-7 cells to paste the next iteration it keeps going because if say cell J52 is the last X and everything to the right of that is blank then it will keep pasting no's when i need it to stop at the last iteration.
Also the code is basically reading from cell G and everything to the right on sheet 1 and paste it into the range in sheet 2 and skip so many rows to paste the next one.
Is there anyway to edit this code
Sub test()
For i = 0 To num_ent
With Worksheets("Sheet1")
lastcol = .Cells(52 + i * 351, .Columns.Count).End(xlToLeft).Column
End With
If lastcol > 7 Then
With Worksheets("Sheet1")
inarr = .Range(.Cells(52 + i * 351, 7), .Cells(52 + i * 351, lastcol))
End With
If inarr(1, 1) <> "" Then
With Worksheets("Sheet2")
For j = 1 To UBound(inarr, 2)
jj = j - 1
.Range(.Cells(163 + jj * 11, 6 + i), .Cells(163 + jj * 11, 6 + i)) = inarr(1, j)
Next j
End With
End If
End If
Next i
End Sub
thank you!
Also the code is basically reading from cell G and everything to the right on sheet 1 and paste it into the range in sheet 2 and skip so many rows to paste the next one.
Is there anyway to edit this code
Sub test()
For i = 0 To num_ent
With Worksheets("Sheet1")
lastcol = .Cells(52 + i * 351, .Columns.Count).End(xlToLeft).Column
End With
If lastcol > 7 Then
With Worksheets("Sheet1")
inarr = .Range(.Cells(52 + i * 351, 7), .Cells(52 + i * 351, lastcol))
End With
If inarr(1, 1) <> "" Then
With Worksheets("Sheet2")
For j = 1 To UBound(inarr, 2)
jj = j - 1
.Range(.Cells(163 + jj * 11, 6 + i), .Cells(163 + jj * 11, 6 + i)) = inarr(1, j)
Next j
End With
End If
End If
Next i
End Sub
thank you!