PDA

View Full Version : VBA: Blank Cells Based on Value



Weezer
09-20-2010, 10:06 AM
Hello everyone!

I am trying to write a macro that will show all values in a specific column as blank if it has numbers in it. I'm assuming that I should use a IF-THEN statement for numbers that are greater than or equal to 0. Should I go this way or is there a way I can delete the column entirely after a certain row which is B9. So whatever comes after B9 I would like to delete it and shift it to the left. I think this is a better approach but I don't know how to go about it.

Any help?

Bob Phillips
09-20-2010, 10:35 AM
Do it ijn Excel with the macro recorder on, this will generate your code.

Weezer
09-20-2010, 10:46 AM
Yeah I know that, I just don't know how to go about writing the code. I know how to delete the column but I'm lost on how to delete only the rows that I want to delete. This is what I have so far
Sub Col_Delete()
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
End Sub

Rows B9,B10,B11 all have numeric values and I want to delete
them & shift the column left. Basically I want to Delete the entire
column B9 all the way downwards & then shift left.

Bob Phillips
09-20-2010, 01:13 PM
You don't need to write the code, the macro recorder will do it.