Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code Help
What is wrong with this code?
Dim xRange As Range Dim xCell As Range For Each xCell In Sheets("CDPTR").Range("A2:CA2") If xCell.Value = 0 Then If xRange Is Nothing Then Set xRange = xCell Else Set xRange = Union(xRange, xCell) End If End If Next xCell xRange.Delete Shift:=xlToRight <<<< Here I get an error??? I used to have this set up to work on a column and it shifted deleted cells up. I need it to work on a row now, though, and to shift the deleted cells to the right???? -- Thanks Shawn |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code Help
Shawn,
You can shift data up or to the left only... xlShiftToLeft or xlShiftUp Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Shawn" wrote in message What is wrong with this code? Dim xRange As Range Dim xCell As Range For Each xCell In Sheets("CDPTR").Range("A2:CA2") If xCell.Value = 0 Then If xRange Is Nothing Then Set xRange = xCell Else Set xRange = Union(xRange, xCell) End If End If Next xCell xRange.Delete Shift:=xlToRight <<<< Here I get an error??? I used to have this set up to work on a column and it shifted deleted cells up. I need it to work on a row now, though, and to shift the deleted cells to the right???? -- Thanks Shawn |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code Help
xRange.Delete Shift:=xlToLeft
HTH -- AP "Shawn" a écrit dans le message de ... What is wrong with this code? Dim xRange As Range Dim xCell As Range For Each xCell In Sheets("CDPTR").Range("A2:CA2") If xCell.Value = 0 Then If xRange Is Nothing Then Set xRange = xCell Else Set xRange = Union(xRange, xCell) End If End If Next xCell xRange.Delete Shift:=xlToRight <<<< Here I get an error??? I used to have this set up to work on a column and it shifted deleted cells up. I need it to work on a row now, though, and to shift the deleted cells to the right???? -- Thanks Shawn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Generic protect/unprotect code through buttons and code? | Excel Programming | |||
run code on opening workbook and apply code to certain sheets | Excel Programming | |||
stubborn Excel crash when editing code with code, one solution | Excel Programming |