I have asked this before, but I added it to an old topic so it's probably not getting looked at. I have code to read several timesheets in a certain dir and compile another spreadsheet from the data in the spreadsheets. The problem I have is when the macro looks up the cell range, and there is no data to report, it puts 0 values in the cells. Is there a way to just skip the process if there is no data to report? In otherwards, leaving the 0's out of the spreadsheet. I'll past some snipits here.
Part 1:
For x = A To Z
Hours_REG = Application.WorksheetFunction.Sum(sht.Range("D" + Format(x)), _
sht.Range("H" + Format(x)), _
sht.Range("L" + Format(x)), _
sht.Range("P" + Format(x)), _
sht.Range("T" + Format(x)), _
sht.Range("X" + Format(x)), _
sht.Range("AB" + Format(x)))
OTHOURS_X1 = Application.WorksheetFunction.Sum(sht.Range("E" + Format(x)), _
sht.Range("I" + Format(x)), _
sht.Range("M" + Format(x)), _
sht.Range("Q" + Format(x)), _
sht.Range("U" + Format(x)), _
sht.Range("Y" + Format(x)), _
sht.Range("AC" + Format(x)))
OTHOURS_X2 = Application.WorksheetFunction.Sum(sht.Range("F" + Format(x)), _
sht.Range("J" + Format(x)), _
sht.Range("N" + Format(x)), _
sht.Range("R" + Format(x)), _
sht.Range("V" + Format(x)), _
sht.Range("Z" + Format(x)), _
sht.Range("AD" + Format(x)))
OTHOURS_X3 = Application.WorksheetFunction.Sum(sht.Range("G" + Format(x)), _
sht.Range("K" + Format(x)), _
sht.Range("O" + Format(x)), _
sht.Range("S" + Format(x)), _
sht.Range("W" + Format(x)), _
sht.Range("AA" + Format(x)), _
sht.Range("AE" + Format(x)))
Part 2:
If Hours > 0 Then
row = ListPointer
Sheet3.Cells(row, 1) = eName
Sheet3.Cells(row, 2) = eNumber
Sheet3.Cells(row, 3) = eCentre
Sheet3.Cells(row, 4) = Week
Sheet3.Cells(row, 5) = Activity
Sheet3.Cells(row, 6) = Hours_REG
Sheet3.Cells(row, 7) = FileName
Sheet3.Cells(row,
= OTHOURS_X1
Sheet3.Cells(row, 9) = OTHOURS_X2
Sheet3.Cells(row, 10) = OTHOURS_X3
ListPointer = ListPointer + 1
End If
Next x
End If
Is there a way to edit this code to not show 0 values?
BTW, how do I attach an excel file to this post?