I need some help with do an "if" statement. I want to have vba look at a column and to see whether or not there is a value in that column. If there is, remove all the blank cells above it so that it moves to the top. If there is no value then this code doesn't need to run. If not running the code is not possible to code then I can just simply spit out a random number someone in the sheet where it wont have an effect on the rest of my data.
Code:
If Range("M2:M" & last) 'contains any value
Then
last = Range("M:M").Find("*" , , , , 1, 2).Offset(1).Row
Range("M2:M" & last).SpecialCells(xlCellTypeBlanks).Delete xlUp
Else
'do nothing
End if