Delete Zero 0 and shift the cells up

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I think we are going to need more information.
What does your data structure look like?
What range are we checking for zeroes?
Do you want to shifts all cells (rows) up, or just that one column?
Does using filters to filter out the zeroes do what you want?
 
Upvote 0
The data is in column C. all the numbers are 6 digits there are few cell where the value is "0" I want those cells to delete and move the cells up

I think we are going to need more information.
What does your data structure look like?
What range are we checking for zeroes?
Do you want to shifts all cells (rows) up, or just that one column?
Does using filters to filter out the zeroes do what you want?
 
Upvote 0
So, just to confirm, you want the data in column C to move up, but you do not want any of the other columns to move up along with it?
 
Upvote 0
OK, if you really do not want the other columns to move up to, try this code:
Code:
Sub MyDeleteMacro()

'   Replace all zeroes in column C with blanks
    Columns("C:C").Replace What:="0", Replacement:="", LookAt:=xlWhole, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
'   Delete all blank cells and shift cells up
    Columns("C:C").SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp
    
End Sub
 
Upvote 0
Thats exactly what i wanted.. Thank you so much
OK, if you really do not want the other columns to move up to, try this code:
Code:
Sub MyDeleteMacro()

'   Replace all zeroes in column C with blanks
    Columns("C:C").Replace What:="0", Replacement:="", LookAt:=xlWhole, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
'   Delete all blank cells and shift cells up
    Columns("C:C").SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top