Hi, I'm having a little trouble with this code below, the code works perfectly fine but stops when it finds an empty row. I intentionally include 1 blank row between groups of rows on the spreadsheet i'm working on. This cause's this code to stop after one group, i've tried telling the code to check the first empty row with the next row coming up to see if that row is empty also but my attempts failed & i'm not sure how to do it.
I have included the code below.
Can this code be made to only stop once it finds 2 empty rows and not just 1?
Below working code if no blank rows are present.
Sub ImageUpload()
Dim intUnit As Integer
Dim lngRow As Long
Dim strFileName As String
strFileName = "C:\Users\James\Desktop\ImageUpload.bps"
intUnit = FreeFile
Open strFileName For Output As intUnit
lngRow = 6
Do While Len(Cells(lngRow, 1).Value) > 0
If Cells(lngRow, 53).Value = "m" Then
Print #intUnit, Cells(lngRow, 55).Value
Print #intUnit, "1"
Print #intUnit, "2"
Print #intUnit, "0"
Print #intUnit, "?"
Print #intUnit, Cells(lngRow, 56).Value
End If
lngRow = lngRow + 1
Loop
Close intUnit
End Sub
below code that i tried editing to check for 2 rows.
Sub ImageUpload()
Dim intUnit As Integer
Dim lngRow As Long
Dim strFileName As String
strFileName = "C:\Users\James\Desktop\ImageUpload.bps"
intUnit = FreeFile
Open strFileName For Output As intUnit
lngRow = 6
Do While Len(Cells(lngRow, 1).Value) & Len(Cells(lngRow + 1, 1).Value) > 0
If Cells(lngRow, 53).Value = "m" Then
Print #intUnit, Cells(lngRow, 55).Value
Print #intUnit, "1"
Print #intUnit, "2"
Print #intUnit, "0"
Print #intUnit, "?"
Print #intUnit, Cells(lngRow, 56).Value
End If
lngRow = lngRow + 1
Loop
Close intUnit
End Sub
Thanks
Bookmarks