Good morning my code is set to ignore blanks and move on which seems to work well, the problem occurs when the cell contains a space it trys to work with it.. I have attached code below so far any thoughts appreciated
Sub GI()
Dim row As Integer
Dim column As Integer
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim wb As Workbook
Dim print_row As Integer
Dim rs1 As Long
Dim re1 As Long
Dim cs1 As Long
Dim ce1 As Long
rs1 = Sheets("data").Range("b1").Value 'row start value set from textboxt
re1 = Sheets("data").Range("b2").Value 'row end value set from textboxt
cs1 = Sheets("data").Range("b3").Value 'col start value set from textboxt
ce1 = Sheets("data").Range("b4").Value 'col end value set from textboxt
Set wb = ThisWorkbook
Set ws1 = wb.Sheets("C&E")
Set ws2 = wb.Sheets("Print")
print_row = 13
ws2.Rows("13:100000").EntireRow.Delete
For row = rs1 To re1
For column = cs1 To ce1
'If IsEmpty(ws1.Cells(row, column).Value) = True Then
'Do nothing
If IsEmpty(ws1.Cells(row, column).Value) = True Then
'Do nothing
ElseIf IsNumeric(ws1.Cells(row, column).Value) = True Then
If (IsEmpty(ws1.Cells(row, 3).Value) = True Or IsEmpty(ws1.Cells(15, column).Value) = True) Then
'Do nothing
Else
ws2.Cells(print_row, 1).Value = ws1.Cells(row, 3).Value
ws2.Cells(print_row, 2).Value = ws1.Cells(15, column).Value
ws2.Cells(print_row, 3).Value = ws1.Cells(row, column).Value
print_row = print_row + 1
End If
ElseIf ws1.Cells(row, column).Value = ws1.Cells(17, 2).Value Then
If (IsEmpty(ws1.Cells(row, 3).Value) = True Or IsEmpty(ws1.Cells(15, column).Value) = True) Then
'Do nothing
Else
ws2.Cells(print_row, 1).Value = ws1.Cells(row, 3).Value
ws2.Cells(print_row, 2).Value = ws1.Cells(15, column).Value
ws2.Cells(print_row, 3).Value = "0"
print_row = print_row + 1
End If
End If
Next column
If IsEmpty(ws1.Cells(row, 3).Value) = True Then
'Do nothing
Else
print_row = print_row
End If
Next row
End Sub
Sub GI()
Dim row As Integer
Dim column As Integer
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim wb As Workbook
Dim print_row As Integer
Dim rs1 As Long
Dim re1 As Long
Dim cs1 As Long
Dim ce1 As Long
rs1 = Sheets("data").Range("b1").Value 'row start value set from textboxt
re1 = Sheets("data").Range("b2").Value 'row end value set from textboxt
cs1 = Sheets("data").Range("b3").Value 'col start value set from textboxt
ce1 = Sheets("data").Range("b4").Value 'col end value set from textboxt
Set wb = ThisWorkbook
Set ws1 = wb.Sheets("C&E")
Set ws2 = wb.Sheets("Print")
print_row = 13
ws2.Rows("13:100000").EntireRow.Delete
For row = rs1 To re1
For column = cs1 To ce1
'If IsEmpty(ws1.Cells(row, column).Value) = True Then
'Do nothing
If IsEmpty(ws1.Cells(row, column).Value) = True Then
'Do nothing
ElseIf IsNumeric(ws1.Cells(row, column).Value) = True Then
If (IsEmpty(ws1.Cells(row, 3).Value) = True Or IsEmpty(ws1.Cells(15, column).Value) = True) Then
'Do nothing
Else
ws2.Cells(print_row, 1).Value = ws1.Cells(row, 3).Value
ws2.Cells(print_row, 2).Value = ws1.Cells(15, column).Value
ws2.Cells(print_row, 3).Value = ws1.Cells(row, column).Value
print_row = print_row + 1
End If
ElseIf ws1.Cells(row, column).Value = ws1.Cells(17, 2).Value Then
If (IsEmpty(ws1.Cells(row, 3).Value) = True Or IsEmpty(ws1.Cells(15, column).Value) = True) Then
'Do nothing
Else
ws2.Cells(print_row, 1).Value = ws1.Cells(row, 3).Value
ws2.Cells(print_row, 2).Value = ws1.Cells(15, column).Value
ws2.Cells(print_row, 3).Value = "0"
print_row = print_row + 1
End If
End If
Next column
If IsEmpty(ws1.Cells(row, 3).Value) = True Then
'Do nothing
Else
print_row = print_row
End If
Next row
End Sub