S
ste mac
Hello to all, this is the scenario: l have 60 sheets in a workbook, 56
of them are named S1, S2, S3 etc etc up to S56, what l want to do is
check a range on each sheet for any blank cells, my problem is that
the range changes on each sheet... this is what l have so far (some
code borrowed from a post by Nick Hodge, thanks Nick)...the start
address of the range will be the same on each sheet which is "A3" the
end of the range will be the last used cell in col AS..
this is where l am beat... the last cell in col AS changes on each
sheet...
it would be nice if it did find any cell with lost data to tell me
what the cell address was, as some of these sheets carry a lot of
data...
Thans for any help....seeya ste
Public Sub checkforlostdata()
Dim myCell As Range
Dim endofrange As Variant
For sheetnumber = 1 To 2
sheetname = "S" & Format(sheetnumber, "##0")
Sheets(sheetname).Select
ActiveSheet.Range("AS1").End(xlDown).Select
ActiveCell.cell.Address = endofrange
For Each myCell In ActiveSheet.Range("A3:endofrange")
If IsEmpty(myCell.Value) Then
MsgBox "There is lost data on sheet " & sheetname
Cancel = True
Exit Sub
End If
Next myCell
Next
End Sub
of them are named S1, S2, S3 etc etc up to S56, what l want to do is
check a range on each sheet for any blank cells, my problem is that
the range changes on each sheet... this is what l have so far (some
code borrowed from a post by Nick Hodge, thanks Nick)...the start
address of the range will be the same on each sheet which is "A3" the
end of the range will be the last used cell in col AS..
this is where l am beat... the last cell in col AS changes on each
sheet...
it would be nice if it did find any cell with lost data to tell me
what the cell address was, as some of these sheets carry a lot of
data...
Thans for any help....seeya ste
Public Sub checkforlostdata()
Dim myCell As Range
Dim endofrange As Variant
For sheetnumber = 1 To 2
sheetname = "S" & Format(sheetnumber, "##0")
Sheets(sheetname).Select
ActiveSheet.Range("AS1").End(xlDown).Select
ActiveCell.cell.Address = endofrange
For Each myCell In ActiveSheet.Range("A3:endofrange")
If IsEmpty(myCell.Value) Then
MsgBox "There is lost data on sheet " & sheetname
Cancel = True
Exit Sub
End If
Next myCell
Next
End Sub