View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
bhofsetz[_23_] bhofsetz[_23_] is offline
external usenet poster
 
Posts: 1
Default Copy non-Zero columns to new location macro


Give this a try


Code:
--------------------
Sub MoveNonZero()
Dim y As Long, x As Range
y = 1
For Each x In Selection
If x = 0 Then
Else
Range("C" & y) = x.Value
Range("D" & y) = x.Offset(0, 1).Value
y = y + 1
End If
Next x
End Sub
--------------------


Select the range or column you want to operate on and then run the
marco.

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=379709