I have a relatively simple scheduling spreadsheet I am trying to make "Idiot" proof.
The data range of the spreadsheet is 8 columns wide and generally 100 rows deep.
I have the code to check if each cell is empty and only lock the cells with data. This works well.
The problem I have at the moment is that the only way I know how to write the select cell part is by repeatdly naming the cell like this
Range("C33").Select
If Range("C33").Value = "" Then
Selection.Locked = False
Else
Selection.Locked = True
End If
Then repeating it
Range("E33").Select
If Range("E33").Value = "" Then
Selection.Locked = False
Else
Selection.Locked = True
End If
And so on.
I would prefer if I could specify the complete data range eg C10:J110
then just have the right code check each cell within that range. I dont know how to write the correct offset code and then incorporate it with the "If" code
Any help will be greatly appreciated
The data range of the spreadsheet is 8 columns wide and generally 100 rows deep.
I have the code to check if each cell is empty and only lock the cells with data. This works well.
The problem I have at the moment is that the only way I know how to write the select cell part is by repeatdly naming the cell like this
Range("C33").Select
If Range("C33").Value = "" Then
Selection.Locked = False
Else
Selection.Locked = True
End If
Then repeating it
Range("E33").Select
If Range("E33").Value = "" Then
Selection.Locked = False
Else
Selection.Locked = True
End If
And so on.
I would prefer if I could specify the complete data range eg C10:J110
then just have the right code check each cell within that range. I dont know how to write the correct offset code and then incorporate it with the "If" code
Any help will be greatly appreciated