L
Legacy 93538
Guest
Hi
I have a loop which loops through a cell range and first check if it is empty. It should then say if its got text in to do the following if not ignore the following and go to the next cell. But this not happeneing it is still doing the proedures within the loop even if the cell is empty.
Does anyone know why its doing this?
Thanks
Jessicaseymour
I have a loop which loops through a cell range and first check if it is empty. It should then say if its got text in to do the following if not ignore the following and go to the next cell. But this not happeneing it is still doing the proedures within the loop even if the cell is empty.
Code:
Nrow = 2
For Each cell In Sheets("PPIIIFORM").Range("F4:U644")
If cell.Value > "" Then Sheets("Input_Reference_Table").Cells(Nrow, 1).Value = cell.Value
Sheets("Input_Reference_Table").Cells(Nrow, 2).Value = Sheets("PPIIIFORM").Range("A" & cell.Row)
Sheets("Input_Reference_Table").Cells(Nrow, 3).Value = Sheets("PPIIIFORM").Range("B" & cell.Row)
Sheets("Input_Reference_Table").Cells(Nrow, 4).Value = Sheets("PPIIIFORM").Range("C" & cell.Row)
Sheets("Input_Reference_Table").Cells(Nrow, 5).Value = "True"
Sheets("Input_Reference_Table").Cells(Nrow, 6).Value = Sheets("PPIIIFORM").Range("D" & cell.Row)
Sheets("Input_Reference_Table").Cells(Nrow, 7).Value = Sheets("PPIIIFORM").Range("E" & cell.Row)
Sheets("Input_Reference_Table").Cells(Nrow, 8).Value = Sheets("PPIIIFORM").Range("E" & cell.Row).Value & " - " & Sheets("PPIIIFORM").Range(Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ", cell.column, 1) & "1").Value
Sheets("Input_Reference_Table").Cells(Nrow, 11).Value = cell.column - 5
Sheets("Input_Reference_Table").Cells(Nrow, 12).Value = Not cell.Interior.Color = RGB(217, 217, 217)
Sheets("Input_Reference_Table").Cells(Nrow, 13).Value = "True"
Sheets("Input_Reference_Table").Cells(Nrow, 14).Value = cell.Interior.Color = RGB(255, 255, 0)
Sheets("Input_Reference_Table").Cells(Nrow, 15).Value = Sheets("PPIIIFORM").Range("V" & cell.Row)
Sheets("Input_Reference_Table").Cells(Nrow, 16).Value = Sheets("PPIIIFORM").Range("W" & cell.Row).Value
Sheets("Input_Reference_Table").Cells(Nrow, 17).Value = Sheets("PPIIIFORM").Range("X" & cell.Row).Value
Sheets("Input_Reference_Table").Cells(Nrow, 18).Value = Sheets("PPIIIFORM").Range("Y" & cell.Row).Value
Sheets("Input_Reference_Table").Cells(Nrow, 19).Value = Sheets("PPIIIFORM").Range("Z" & cell.Row).Value
Sheets("Input_Reference_Table").Cells(Nrow, 20).Value = Sheets("PPIIIFORM").Range("AA" & cell.Row).Value
Sheets("Input_Reference_Table").Cells(Nrow, 21).Value = Sheets("PPIIIFORM").Range("AB" & cell.Row).Value
stFormatStyle = cell.NumberFormat
If Right(stFormatStyle, 1) = "%" Then
bIsPercentage = True
stCurrentStyle = "Percent"
stending = "f%%"
Else
bIsPercentage = False
stCurrentStyle = "Decimal"
stending = "f%"
End If
iPeriodPosition = InStr(stFormatStyle, ".")
iDecimals = Len(stFormatStyle) - iPeriodPosition
If bIsPercentage Then iDecimals = iDecimals - 0
Sheets("Input_Reference_Table").Cells(Nrow, 9).Value = "%10." & iDecimals & stending
Nrow = Nrow + 1
Application.StatusBar = cell.Address
Next cell
Does anyone know why its doing this?
Thanks
Jessicaseymour